47 #ifndef _MIRA_POINT_H_ 48 #define _MIRA_POINT_H_ 50 #if CV_MAJOR_VERSION >= 3 51 # include <opencv2/core/types.hpp> 53 # include <opencv2/core/core.hpp> 57 #include <boost/geometry/core/cs.hpp> 58 #include <boost/geometry/geometries/point.hpp> 81 template <
typename T,
int D,
typename Derived>
95 PointBase(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
100 template <
typename DerivedMatrix>
104 template <
typename DerivedMatrix>
111 Derived&
operator=(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other)
113 for(
int i=0; i < D; i++)
114 (*
this)[i] = other(i);
119 operator boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>()
const 121 boost::geometry::model::point<T,D,boost::geometry::cs::cartesian> r;
122 for(
int i=0; i < D; i++)
139 template <
typename T,
int D>
149 template <
typename DerivedMatrix>
153 Point(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
161 template <
typename T,
int D,
typename SerializerTag>
162 class IsTransparentSerializable<Point<T,D>,SerializerTag> :
public std::true_type {};
173 template <
typename T>
190 template <
typename DerivedMatrix>
194 Point(
const boost::geometry::model::point<T,2,boost::geometry::cs::cartesian>& other) {
205 (*this)[0] = other.x;
206 (*this)[1] = other.y;
211 operator cv::Point_<T>()
const 213 return cv::Point_<T>( this->x(), this->y() );
217 template<
typename Reflector>
220 reflector.property(
"X", this->x(),
"The x-coordinate");
221 reflector.property(
"Y", this->y(),
"The y-coordinate");
228 template <
typename T,
typename SerializerTag>
229 class IsTransparentSerializable<Point<T,2>,SerializerTag> :
public std::false_type {};
256 template <
typename T>
274 template <
typename DerivedMatrix>
278 Point(
const boost::geometry::model::point<T,3,boost::geometry::cs::cartesian>& other) {
283 explicit Point(
const cv::Point3_<T> & other) {
289 (*this)[0] = other.x;
290 (*this)[1] = other.y;
291 (*this)[2] = other.z;
296 operator cv::Point3_<T>()
const 298 return cv::Point3_<T>(this->x(),this->y(),this->z());
302 template<
typename Reflector>
305 reflector.property(
"X", this->x(),
"The x-coordinate");
306 reflector.property(
"Y", this->y(),
"The y-coordinate");
307 reflector.property(
"Z", this->z(),
"The z-coordinate");
315 template <
typename T,
typename SerializerTag>
316 class IsTransparentSerializable<Point<T,3>,SerializerTag> :
public std::false_type {};
342 namespace boost {
namespace geometry {
namespace traits {
346 template<
typename T,
int D>
347 struct tag<
mira::Point<T, D> >
348 {
typedef point_tag
type; };
350 template<
typename T,
int D>
351 struct dimension<
mira::Point<T, D> > : boost::mpl::int_<D>
354 template<
typename T,
int D>
355 struct coordinate_type<
mira::Point<T, D> >
358 template<
typename T,
int D>
359 struct coordinate_system<
mira::Point<T, D> >
360 {
typedef cs::cartesian
type; };
362 template<
typename T,
int D, std::
size_t Dimension>
363 struct access<
mira::Point<T, D>, Dimension>
367 return p(Dimension, 0);
371 p(Dimension, 0) = value;
Point & operator=(const cv::Point3_< T > &other)
converts from OpenCV point
Definition: Point.h:288
void reflect(Reflector &reflector)
the reflect method for 2D point serialization
Definition: Point.h:218
T Type
Definition: Point.h:87
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:275
Definition: SyncTimedRead.h:62
Include file for all eigen related things.
General point class template.
Definition: Point.h:140
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:146
Point< int, 2 > Point2i
a 2D integer point
Definition: Point.h:234
Definition: YawPitchRoll.h:684
void reflect(Reflector &reflector)
the reflect method for 3D point serialization
Definition: Point.h:303
Point< double, 2 > Point2d
a 2D 64 bit floating precision point
Definition: Point.h:236
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:191
Specialization of Point for 2 dimensions with specialized constructors and converters.
Definition: Point.h:174
Point(const cv::Point3_< T > &other)
Creates Point from OpenCV point.
Definition: Point.h:283
Point & operator=(const cv::Point_< T > &other)
converts from OpenCV point
Definition: Point.h:204
PointBase(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Create from boost geometry point.
Definition: Point.h:95
Point< int, 3 > Point3i
a 3D integer point
Definition: Point.h:321
Derived & operator=(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
converts from native boost::geometry::model::point
Definition: Point.h:111
Point(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:153
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:180
Matrix & operator=(const RotationBase< OtherDerived, ColsAtCompileTime > &r)
Point(T x, T y, T z)
Creates point from its three coordinates.
Definition: Point.h:266
PointBase(const Eigen::MatrixBase< DerivedMatrix > &other)
Create from Eigen matrix expression.
Definition: Point.h:101
The base template class of point, which covers the basic functionality of each point.
Definition: Point.h:82
Point(T x, T y)
Creates point from its two coordinates.
Definition: Point.h:183
Point< float, 2 > Point2f
a 2D 32 bit floating precision point
Definition: Point.h:235
Point< float, 3 > Point3f
a 3D 32 bit floating precision point
Definition: Point.h:322
Point()
Default-constructor.
Definition: Point.h:263
Derived & operator=(const Eigen::MatrixBase< DerivedMatrix > &other)
assignment of Eigen matrix expression
Definition: Point.h:105
Point(const boost::geometry::model::point< T, 3, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:278
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:150
Point< double, 3 > Point3d
a 3D 64 bit floating precision point
Definition: Point.h:323
PointBase()
Default constructor.
Definition: Point.h:92
Point(const boost::geometry::model::point< T, 2, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:194