47 #ifndef _MIRA_POINT_H_ 48 #define _MIRA_POINT_H_ 50 #include <opencv2/core/core.hpp> 53 #include <boost/geometry/geometry.hpp> 74 template <
typename T,
int D,
typename Derived>
88 PointBase(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
93 template <
typename DerivedMatrix>
97 template <
typename DerivedMatrix>
104 Derived&
operator=(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other)
106 for(
int i=0; i < D; i++)
107 (*
this)[i] = other(i);
112 operator boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>()
const 114 boost::geometry::model::point<T,D,boost::geometry::cs::cartesian> r;
115 for(
int i=0; i < D; i++)
132 template <
typename T,
int D>
142 template <
typename DerivedMatrix>
146 Point(
const boost::geometry::model::point<T,D,boost::geometry::cs::cartesian>& other) {
154 template <
typename T,
int D,
typename SerializerTag>
155 class IsTransparentSerializable<Point<T,D>,SerializerTag> :
public std::true_type {};
166 template <
typename T>
183 template <
typename DerivedMatrix>
187 Point(
const boost::geometry::model::point<T,2,boost::geometry::cs::cartesian>& other) {
198 (*this)[0] = other.x;
199 (*this)[1] = other.y;
204 operator cv::Point_<T>()
const 206 return cv::Point_<T>( this->x(), this->y() );
210 template<
typename Reflector>
213 reflector.property(
"X", this->x(),
"The x-coordinate");
214 reflector.property(
"Y", this->y(),
"The y-coordinate");
221 template <
typename T,
typename SerializerTag>
222 class IsTransparentSerializable<Point<T,2>,SerializerTag> :
public std::false_type {};
238 template <
typename T>
256 template <
typename DerivedMatrix>
260 Point(
const boost::geometry::model::point<T,3,boost::geometry::cs::cartesian>& other) {
265 explicit Point(
const cv::Point3_<T> & other) {
271 (*this)[0] = other.x;
272 (*this)[1] = other.y;
273 (*this)[2] = other.z;
278 operator cv::Point3_<T>()
const 280 return cv::Point3_<T>(this->x(),this->y(),this->z());
284 template<
typename Reflector>
287 reflector.property(
"X", this->x(),
"The x-coordinate");
288 reflector.property(
"Y", this->y(),
"The y-coordinate");
289 reflector.property(
"Z", this->z(),
"The z-coordinate");
297 template <
typename T,
typename SerializerTag>
298 class IsTransparentSerializable<Point<T,3>,SerializerTag> :
public std::false_type {};
313 namespace boost {
namespace geometry {
namespace traits {
317 template<
typename T,
int D>
318 struct tag<
mira::Point<T, D> >
319 {
typedef point_tag
type; };
321 template<
typename T,
int D>
322 struct dimension<
mira::Point<T, D> > : boost::mpl::int_<D>
325 template<
typename T,
int D>
326 struct coordinate_type<
mira::Point<T, D> >
329 template<
typename T,
int D>
330 struct coordinate_system<
mira::Point<T, D> >
331 {
typedef cs::cartesian
type; };
333 template<
typename T,
int D, std::
size_t Dimension>
334 struct access<
mira::Point<T, D>, Dimension>
338 return p(Dimension, 0);
342 p(Dimension, 0) = value;
Point & operator=(const cv::Point3_< T > &other)
converts from OpenCV point
Definition: Point.h:270
void reflect(Reflector &reflector)
the reflect method for 2D point serialization
Definition: Point.h:211
T Type
Definition: Point.h:80
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:257
Definition: SyncTimedRead.h:62
Include file for all eigen related things.
General point class template.
Definition: Point.h:133
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:139
Point< int, 2 > Point2i
a 2D integer point
Definition: Point.h:227
Definition: YawPitchRoll.h:684
void reflect(Reflector &reflector)
the reflect method for 3D point serialization
Definition: Point.h:285
Point< double, 2 > Point2d
a 2D 64 bit floating precision point
Definition: Point.h:229
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:184
Specialization of Point for 2 dimensions with specialized constructors and converters.
Definition: Point.h:167
Point(const cv::Point3_< T > &other)
Creates Point from OpenCV point.
Definition: Point.h:265
Point & operator=(const cv::Point_< T > &other)
converts from OpenCV point
Definition: Point.h:197
PointBase(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Create from boost geometry point.
Definition: Point.h:88
Point< int, 3 > Point3i
a 3D integer point
Definition: Point.h:303
Derived & operator=(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
converts from native boost::geometry::model::point
Definition: Point.h:104
Point(const boost::geometry::model::point< T, D, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:146
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
Point()
Default-constructor.
Definition: Point.h:173
Matrix & operator=(const RotationBase< OtherDerived, ColsAtCompileTime > &r)
Point(T x, T y, T z)
Creates point from its three coordinates.
Definition: Point.h:248
PointBase(const Eigen::MatrixBase< DerivedMatrix > &other)
Create from Eigen matrix expression.
Definition: Point.h:94
The base template class of point, which covers the basic functionality of each point.
Definition: Point.h:75
Point(T x, T y)
Creates point from its two coordinates.
Definition: Point.h:176
Point< float, 2 > Point2f
a 2D 32 bit floating precision point
Definition: Point.h:228
Point< float, 3 > Point3f
a 3D 32 bit floating precision point
Definition: Point.h:304
Point()
Default-constructor.
Definition: Point.h:245
Derived & operator=(const Eigen::MatrixBase< DerivedMatrix > &other)
assignment of Eigen matrix expression
Definition: Point.h:98
Point(const boost::geometry::model::point< T, 3, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:260
Point(const Eigen::MatrixBase< DerivedMatrix > &other)
Creates Point from Eigen matrix.
Definition: Point.h:143
Point< double, 3 > Point3d
a 3D 64 bit floating precision point
Definition: Point.h:305
PointBase()
Default constructor.
Definition: Point.h:85
Point(const boost::geometry::model::point< T, 2, boost::geometry::cs::cartesian > &other)
Creates Point from boost::geometry::point.
Definition: Point.h:187