47 #ifndef _MIRA_POINT_H_ 48 #define _MIRA_POINT_H_ 50 #include <opencv2/core/core.hpp> 53 #include <boost/geometry/geometry.hpp> 76 template <
typename T,
int D,
typename Derived>
90 PointBase(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
95 template <
typename DerivedMatrix>
99 template <
typename DerivedMatrix>
106 Derived&
operator=(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other)
108 for(
int i=0; i < D; i++)
109 (*
this)[i] = other(i);
114 operator boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>()
const 116 boost::geometry::model::point<T,D,boost::geometry::cs::cartesian> r;
117 for(
int i=0; i < D; i++)
134 template <
typename T,
int D>
144 template <
typename DerivedMatrix>
148 Point(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
156 template <
typename T,
int D,
typename SerializerTag>
157 class IsTransparentSerializable<Point<T,D>,SerializerTag> :
public std::true_type {};
168 template <
typename T>
185 template <
typename DerivedMatrix>
189 Point(
const boost::geometry::model::point<T,2,boost::geometry::cs::cartesian>& other) {
200 (*this)[0] = other.x;
201 (*this)[1] = other.y;
206 operator cv::Point_<T>()
const 208 return cv::Point_<T>( this->x(), this->y() );
212 template<
typename Reflector>
215 reflector.property(
"X", this->x(),
"The x-coordinate");
216 reflector.property(
"Y", this->y(),
"The y-coordinate");
223 template <
typename T,
typename SerializerTag>
224 class IsTransparentSerializable<Point<T,2>,SerializerTag> :
public std::false_type {};
251 template <
typename T>
269 template <
typename DerivedMatrix>
273 Point(
const boost::geometry::model::point<T,3,boost::geometry::cs::cartesian>& other) {
278 explicit Point(
const cv::Point3_<T> & other) {
284 (*this)[0] = other.x;
285 (*this)[1] = other.y;
286 (*this)[2] = other.z;
291 operator cv::Point3_<T>()
const 293 return cv::Point3_<T>(this->x(),this->y(),this->z());
297 template<
typename Reflector>
300 reflector.property(
"X", this->x(),
"The x-coordinate");
301 reflector.property(
"Y", this->y(),
"The y-coordinate");
302 reflector.property(
"Z", this->z(),
"The z-coordinate");
310 template <
typename T,
typename SerializerTag>
311 class IsTransparentSerializable<Point<T,3>,SerializerTag> :
public std::false_type {};
337 namespace boost {
namespace geometry {
namespace traits {
341 template<
typename T,
int D>
342 struct tag<
mira::Point<T, D> >
343 {
typedef point_tag
type; };
345 template<
typename T,
int D>
346 struct dimension<
mira::Point<T, D> > : boost::mpl::int_<D>
349 template<
typename T,
int D>
350 struct coordinate_type<
mira::Point<T, D> >
353 template<
typename T,
int D>
354 struct coordinate_system<
mira::Point<T, D> >
355 {
typedef cs::cartesian
type; };
357 template<
typename T,
int D, std::
size_t Dimension>
358 struct access<
mira::Point<T, D>, Dimension>
362 return p(Dimension, 0);
366 p(Dimension, 0) = value;
Point & operator=(const cv::Point3_< T > &other)
converts from OpenCV point
Definition: Point.h:283
void reflect(Reflector &reflector)
the reflect method for 2D point serialization
Definition: Point.h:213
T Type
Definition: Point.h:82
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:270
Definition: SyncTimedRead.h:62
Include file for all eigen related things.
General point class template.
Definition: Point.h:135
Preprocessor workaround to handle single parameters that contain a comma.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Point()
Default constructor.
Definition: Point.h:141
Point< int, 2 > Point2i
a 2D integer point
Definition: Point.h:229
Definition: YawPitchRoll.h:684
void reflect(Reflector &reflector)
the reflect method for 3D point serialization
Definition: Point.h:298
Point< double, 2 > Point2d
a 2D 64 bit floating precision point
Definition: Point.h:231
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:186
Specialization of Point for 2 dimensions with specialized constructors and converters.
Definition: Point.h:169
Point(const cv::Point3_< T > &other)
Creates Point from OpenCV point.
Definition: Point.h:278
Point & operator=(const cv::Point_< T > &other)
converts from OpenCV point
Definition: Point.h:199
PointBase(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Create from boost geometry point.
Definition: Point.h:90
Point< int, 3 > Point3i
a 3D integer point
Definition: Point.h:316
Derived & operator=(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
converts from native boost::geometry::model::point
Definition: Point.h:106
Point(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:148
By default, IsCheapToCopy<T>::value evaluates to true for fundamental types T, false for all other ty...
Definition: IsCheapToCopy.h:63
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
Type trait to define if a class is cheap to copy.
Point()
Default-constructor.
Definition: Point.h:175
Matrix & operator=(const RotationBase< OtherDerived, ColsAtCompileTime > &r)
Point(T x, T y, T z)
Creates point from its three coordinates.
Definition: Point.h:261
PointBase(const Eigen::MatrixBase< DerivedMatrix > &other)
Create from Eigen matrix expression.
Definition: Point.h:96
The base template class of point, which covers the basic functionality of each point.
Definition: Point.h:77
Point(T x, T y)
Creates point from its two coordinates.
Definition: Point.h:178
Point< float, 2 > Point2f
a 2D 32 bit floating precision point
Definition: Point.h:230
Point< float, 3 > Point3f
a 3D 32 bit floating precision point
Definition: Point.h:317
Point()
Default-constructor.
Definition: Point.h:258
Derived & operator=(const Eigen::MatrixBase< DerivedMatrix > &other)
assignment of Eigen matrix expression
Definition: Point.h:100
Point(const boost::geometry::model::point< T, 3, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:273
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:145
Point< double, 3 > Point3d
a 3D 64 bit floating precision point
Definition: Point.h:318
PointBase()
Default constructor.
Definition: Point.h:87
Point(const boost::geometry::model::point< T, 2, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:189