9 #ifndef LIGHTWEIGHT_GEOM_DATA_H 10 #define LIGHTWEIGHT_GEOM_DATA_H 13 #include <mrpt/config.h> 54 template <
class DERIVEDCLASS>
65 inline TPoint2D(
double xx,
double yy):x(xx),y(yy) {}
71 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
default:
throw std::out_of_range(
"index out of range"); } }
73 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
default:
throw std::out_of_range(
"index out of range"); } }
137 void fromString(
const std::string &s);
138 static size_t size() {
return 2; }
174 inline TPose2D(
double xx,
double yy,
double pphi):x(xx),y(yy),phi(pphi) {}
180 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return phi;
default:
throw std::out_of_range(
"index out of range"); } }
182 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return phi;
default:
throw std::out_of_range(
"index out of range"); } }
188 v[0]=x; v[1]=y; v[2]=phi;
193 void asString(std::string &s)
const;
200 void fromString(
const std::string &s);
201 static size_t size() {
return 3; }
215 inline TPoint3Df(
const float xx,
const float yy,
const float zz) : x(xx), y(yy),z(zz) { }
219 inline float &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
throw std::out_of_range(
"index out of range"); } }
222 inline const float &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
throw std::out_of_range(
"index out of range"); } }
234 inline TPoint3D(
double xx,
double yy,
double zz):x(xx),y(yy),z(zz) {}
265 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
throw std::out_of_range(
"index out of range"); } }
267 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
throw std::out_of_range(
"index out of range"); } }
296 template <
class VECTORLIKE>
299 v[0]=x; v[1]=y; v[2]=z;
352 void fromString(
const std::string &s);
353 static size_t size() {
return 3; }
361 inline TPointXYZIu8(
double x,
double y,
double z, uint8_t intensity_val) : pt(x,y,z),intensity(intensity_val) {}
368 inline TPointXYZRGBu8(
double x,
double y,
double z, uint8_t R_val, uint8_t G_val, uint8_t B_val) : pt(x,y,z),R(R_val),G(G_val),B(B_val) {}
375 inline TPointXYZfIu8(
float x,
float y,
float z, uint8_t intensity_val) : pt(x,y,z),intensity(intensity_val) {}
382 inline TPointXYZfRGBu8(
float x,
float y,
float z, uint8_t R_val, uint8_t G_val, uint8_t B_val) : pt(x,y,z),R(R_val),G(G_val),B(B_val) {}
417 TPose3D(
double _x,
double _y,
double _z,
double _yaw,
double _pitch,
double _roll):x(_x),y(_y),z(_z),yaw(_yaw),
pitch(_pitch),
roll(_roll) {}
423 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
case 3:
return yaw;
case 4:
return pitch;
case 5:
return roll;
default:
throw std::out_of_range(
"index out of range"); } }
425 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
case 3:
return yaw;
case 4:
return pitch;
case 5:
return roll;
default:
throw std::out_of_range(
"index out of range"); } }
437 v[0]=x; v[1]=y; v[2]=z; v[3]=yaw; v[4]=
pitch; v[5]=
roll;
442 void asString(std::string &s)
const;
449 void fromString(
const std::string &s);
450 static size_t size() {
return 6; }
462 inline TPose3DQuat(
double _x,
double _y,
double _z,
double _qr,
double _qx,
double _qy,
double _qz):x(_x),y(_y),z(_z),qr(_qr),qx(_qx),qy(_qy),qz(_qz) { }
469 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
case 3:
return qr;
case 4:
return qx;
case 5:
return qy;
case 6:
return qz;
default:
throw std::out_of_range(
"index out of range"); } }
471 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
case 3:
return qr;
case 4:
return qx;
case 5:
return qy;
case 6:
return qz;
default:
throw std::out_of_range(
"index out of range"); } }
479 for (
size_t i=0;i<7;i++) v[i]=(*
this)[i];
491 void fromString(
const std::string &s);
492 static size_t size() {
return 7; }
513 return (p1.
x==p2.
x)&&(p1.
y==p2.
y);
519 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y);
525 return (p1.
x==p2.
x)&&(p1.
y==p2.
y)&&(p1.
z==p2.
z);
531 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y)||(p1.
z!=p2.
z);
581 double length()
const;
589 double signedDistance(
const TPoint2D &point)
const;
593 bool contains(
const TPoint2D &point)
const;
595 inline TPoint2D &
operator[](
size_t i) {
switch (i) {
case 0:
return point1;
case 1:
return point2;
default:
throw std::out_of_range(
"index out of range"); } }
597 inline const TPoint2D &
operator[](
size_t i)
const {
switch (i) {
case 0:
return point1;
case 1:
return point2;
default:
throw std::out_of_range(
"index out of range"); } }
606 p.
x=(point1.
x+point2.
x)/2;
607 p.
y=(point1.
y+point2.
y)/2;
641 double length()
const;
653 bool contains(
const TPoint3D &point)
const;
655 inline TPoint3D &
operator[](
size_t i) {
switch (i) {
case 0:
return point1;
case 1:
return point2;
default:
throw std::out_of_range(
"index out of range"); } }
657 inline const TPoint3D &
operator[](
size_t i)
const {
switch (i) {
case 0:
return point1;
case 1:
return point2;
default:
throw std::out_of_range(
"index out of range"); } }
668 p.
x=(point1.
x+point2.
x)/2;
669 p.
y=(point1.
y+point2.
y)/2;
670 p.
z=(point1.
z+point2.
z)/2;
717 double evaluatePoint(
const TPoint2D &point)
const;
721 bool contains(
const TPoint2D &point)
const;
729 double signedDistance(
const TPoint2D &point)
const;
733 void getNormalVector(
double (&vector)[2])
const;
743 getNormalVector(vector);
748 void getDirectorVector(
double (&vector)[2])
const;
754 getDirectorVector(vector);
759 void generate3DObject(
TLine3D &l)
const;
816 bool contains(
const TPoint3D &point)
const;
829 for (
size_t i=0;i<3;i++) vector[i]=director[i];
836 getDirectorVector(vector);
877 double evaluatePoint(
const TPoint3D &point)
const;
881 bool contains(
const TPoint3D &point)
const;
886 return contains(segment.
point1)&&contains(segment.
point2);
891 bool contains(
const TLine3D &line)
const;
903 void getNormalVector(
double (&vec)[3])
const;
913 getNormalVector(vec);
961 inline TPlane(
double A,
double B,
double C,
double D) {
971 for (
size_t i=0;i<4;i++) coefs[i]=vec[i];
990 bool contains(
const TPoint2D &point)
const;
994 void getAsSegmentList(std::vector<TSegment2D> &v)
const;
1006 bool isConvex()
const;
1011 void removeRepeatedVertices();
1016 void removeRedundantVertices();
1021 void getPlotData(std::vector<double> &x,std::vector<double> &y)
const;
1042 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon2D &poly);
1063 bool contains(
const TPoint3D &point)
const;
1067 void getAsSegmentList(std::vector<TSegment3D> &v)
const;
1071 bool getPlane(
TPlane &p)
const;
1076 void getBestFittingPlane(
TPlane &p)
const;
1092 bool isSkew()
const;
1096 void removeRepeatedVertices();
1100 void removeRedundantVertices();
1121 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon3D &poly);
1260 }
else return false;
1269 }
else return false;
1278 }
else return false;
1287 }
else return false;
1293 if (
this==&obj)
return *
this;
1295 switch (type=obj.
type) {
1346 void generate3DObject(
TObject3D &obj)
const;
1356 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts);
1360 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms);
1364 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins);
1368 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys);
1372 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts,std::vector<TObject2D> &remainder);
1376 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms,std::vector<TObject2D> &remainder);
1380 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins,std::vector<TObject2D> &remainder);
1384 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys,std::vector<TObject2D> &remainder);
1499 }
else return false;
1508 }
else return false;
1517 }
else return false;
1526 }
else return false;
1535 }
else return false;
1541 if (
this==&obj)
return *
this;
1543 switch (type=obj.
type) {
1625 throw std::logic_error(
"Too many dimensions");
1640 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts);
1644 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms);
1648 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins);
1652 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns);
1656 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys);
1660 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts,std::vector<TObject3D> &remainder);
1664 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms,std::vector<TObject3D> &remainder);
1668 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins,std::vector<TObject3D> &remainder);
1672 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns,std::vector<TObject3D> &remainder);
1676 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys,std::vector<TObject3D> &remainder);
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
void getCenter(TPoint2D &p) const
Segment's central point.
TSegment2D(const TPoint2D &p1, const TPoint2D &p2)
Constructor from both points.
TPoint2D & operator+=(const TPoint2D &p)
double & operator[](size_t i)
Coordinate access using operator[].
const unsigned char GEOMETRIC_TYPE_PLANE
Object type identifier for TPlane.
bool getPoint(TPoint2D &p) const
Gets the content as a point, returning false if the type is inadequate.
A pair (x,y) of pixel coordinates (subpixel resolution).
void getUnitaryNormalVector(double(&vector)[2])
Get line's normal vector after unitarizing line.
TPolygon3D(const std::vector< TPoint3D > &v)
Implicit constructor from a 3D points vector.
TPoint2D operator/(double d) const
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
TPointXYZIu8(double x, double y, double z, uint8_t intensity_val)
bool getPolygon(TPolygon2D &p) const
Gets the content as a polygon, returning false if the type is inadequate.
TPoint2D & operator*=(double d)
const unsigned char GEOMETRIC_TYPE_LINE
Object type identifier for TLine2D or TLine3D.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04]" )
TPointXYZfIu8(float x, float y, float z, uint8_t intensity_val)
unsigned char getType() const
Gets content type.
bool isPolygon() const
Checks whether content is a polygon.
void destroy()
Destroys the object and releases the pointer, if any.
const unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
T square(const T x)
Inline function for the square of a number.
TObject2D(const TPoint2D &p)
Implicit constructor from point.
TPoint3Df(const float xx, const float yy, const float zz)
TLine2D()
Fast default constructor.
bool getSegment(TSegment3D &s) const
Gets the content as a segment, returning false if the type is not adequate.
bool contains(const TSegment3D &segment) const
Check whether a segment is fully contained into the plane.
double roll
Roll coordinate (rotation angle over X coordinate).
TPoint3D(double xx, double yy, double zz)
Constructor from coordinates.
TPointXYZfRGBu8(float x, float y, float z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
std::ostream BASE_IMPEXP & operator<<(std::ostream &o, const TPoint2D &p)
TPolygon3D()
Default constructor.
#define THROW_EXCEPTION(msg)
void operator=(const TPoint2D &p)
Assign a point to this object.
double norm() const
Point norm.
const float & operator[](size_t i) const
Coordinate access using operator[].
void operator=(const TSegment2D &s)
Assign a segment to this object.
std::string asString() const
Union containing pointer to actual data.
TPoint3D()
Default fast constructor.
TPoint3D operator+(const TPoint3D &p) const
Points addition.
Standard type for storing any lightweight 2D type.
TLine3D()
Fast default constructor.
bool getLine(TLine2D &r) const
Gets the content as a line, returning false if the type is inadequate.
TObject2D()
Implicit constructor from polygon.
void getAsPose3D(mrpt::poses::CPose3D &outPose)
Gets a pose whose XY plane corresponds to this plane.
bool getPlane(TPlane &p) const
Gets the content as a plane, returning false if the type is not adequate.
TPoint3D pBase
Base point.
Standard object for storing any 3D lightweight object.
bool getSegment(TSegment2D &s) const
Gets the content as a segment, returning false if the type is inadequate.
TSegment3D()
Fast default constructor.
TObject3D()
Empty constructor.
double z
X,Y,Z coordinates.
TPoint3D & operator+=(const TPoint3D &p)
Translation.
struct BASE_IMPEXP TObject3D
double yaw
Yaw coordinate (rotation angle over Z axis).
void operator=(const TSegment3D &s)
Assigns a segment to this object.
void operator=(const TPoint3D &p)
Assigns a point to this object.
TPose2D(double xx, double yy, double pphi)
Constructor from coordinates.
TSegment3D(const TSegment2D &s)
Constructor from 2D object.
struct BASE_IMPEXP TSegment3D
double norm() const
Pose's spatial coordinates norm.
void getUnitaryDirectorVector(double(&vector)[2])
Unitarize line and then get director vector.
double & operator[](size_t i)
Coordinate access using operator[].
TPoint2D(const mrpt::poses::CPoseOrPoint< DERIVEDCLASS > &p)
Constructor from CPoseOrPoint, perhaps losing 3D information.
TObject3D(const TPlane &p)
Constructor from plane.
TPoint3D point1
Origin point.
void getUnitaryDirectorVector(double(&vector)[3])
Unitarize and then get director vector.
void generate2DObject(TLine2D &l) const
Project into 2D space, discarding the Z coordinate.
TPose3D()
Default fast constructor.
TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
bool getPolygon(TPolygon3D &p) const
Gets the content as a polygon, returning false if the type is not adequate.
This base provides a set of functions for maths stuff.
2D segment, consisting of two points.
bool isPoint() const
Checks whether content is a point.
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
3D segment, consisting of two points.
struct mrpt::math::TObject2D::tobject2d_data_t data
TObject2D(const TLine2D &r)
Implicit constructor from line.
Lightweight 3D point (float version).
TObject3D(const TPoint3D &p)
Constructor from point.
TPoint2D(double xx, double yy)
Constructor from coordinates.
const double & operator[](size_t i) const
Coordinate access using operator[].
TPoint3D point2
Destiny point.
float & operator[](size_t i)
Coordinate access using operator[].
std::string asString() const
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
struct mrpt::math::TObject3D::tobject3d_data_t data
TObject3D & operator=(const TObject3D &obj)
Assigns another object, creating a new pointer if needed.
std::vector< T1 > & operator+=(std::vector< T1 > &a, const std::vector< T2 > &b)
a+=b (element-wise sum)
TLine2D(double A, double B, double C)
Constructor from line's coefficients.
double z
Translation in x,y,z.
const double & operator[](size_t i) const
Coordinate access using operator[].
const unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
const TPoint3D & operator[](size_t i) const
Access to points using operator[0-1].
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
TPoint3D operator/(double d) const
XYZ point (float) + RGB(u8)
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
void generate2DObject(TPolygon2D &p) const
Projects into a 2D space, discarding the z.
3D Plane, represented by its equation
void getDirectorVector(double(&vector)[3]) const
Get director vector.
class BASE_IMPEXP TPolygon3D
TPoint2D operator*(double d) const
TPolygon2D()
Default constructor.
void operator=(const TPolygon3D &p)
Assigns a polygon to this object.
void getCenter(TPoint3D &p) const
Segment's central point.
TPoint3D operator*(double d) const
unsigned char type
Object type identifier.
TPose3DQuat()
Default fast constructor.
TPoint2D point2
Destiny point.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
bool isSegment() const
Checks whether content is a segment.
XYZ point (float) + Intensity(u8)
TObject2D(const TObject2D &obj)
Constructor from another TObject2D.
The base template class for 2D & 3D points and poses.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
TPoint2D & operator[](size_t i)
Access to points using operator[0-1].
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
TObject2D & operator=(const TObject2D &obj)
Assign another TObject2D.
double qz
Unit quaternion part, qr,qx,qy,qz.
bool isPlane() const
Checks whether content is a plane.
A class used to store a 2D point.
A class used to store a 3D point.
void operator=(const TPlane &p)
Assigns a plane to this object.
TObject2D(const TSegment2D &s)
Implicit constructor from segment.
TPolygon2D(size_t N)
Constructor for a given number of vertices, intializing them as garbage.
bool getPoint(TPoint3D &p) const
Gets the content as a point, returning false if the type is not adequate.
double pitch
Pitch coordinate (rotation angle over Y axis).
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
void getAsPose3DForcingOrigin(const TPoint3D &newOrigin, mrpt::poses::CPose3D &pose) const
Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates.
TPoint2D point1
Origin point.
double norm() const
Point norm.
TPoint2D()
Default fast constructor.
bool operator<(const CArray< T, N > &x, const CArray< T, N > &y)
TPoint3D & operator*=(const double f)
Point scale.
BASE_IMPEXP ::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrixPtr &pObj)
T square(const T x)
Inline function for the square of a number.
TPoint2D operator+(const TPoint2D &p) const
TObject3D(const TLine3D &r)
Constructor from line.
bool isLine() const
Checks whether content is a line.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
const double & operator[](size_t i) const
Coordinate access using operator[].
TPlane()
Fast default constructor.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0....
std::string asString() const
TPose3DQuat(double _x, double _y, double _z, double _qr, double _qx, double _qy, double _qz)
Constructor from coordinates.
void operator=(const TPolygon2D &p)
Assign a polygon to this object.
TPoint3D operator-(const TPoint3D &p) const
Points substraction.
XYZ point (double) + RGB(u8)
A class used to store a 2D pose.
TPoint2D operator-(const TPoint2D &p) const
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
struct BASE_IMPEXP TLine3D
double sqrDistanceTo(const TPoint3D &p) const
Point-to-point distance, squared.
void getUnitaryNormalVector(double(&vec)[3])
Unitarize, then get normal vector.
double norm() const
Pose's spatial coordinates norm.
TSegment2D()
Fast default constructor.
unsigned char type
Object type identifier.
~TObject2D()
Object destruction.
const TPoint2D & operator[](size_t i) const
Access to points using operator[0-1].
TPoint3D & operator[](size_t i)
Access to points using operator[0-1].
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
bool getLine(TLine3D &r) const
Gets the content as a line, returning false if the type is not adequate.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
std::string asString() const
void generate2DObject(TSegment2D &s) const
Projection into 2D space, discarding the z.
void generate2DObject(TObject2D &obj) const
Projects into 2D space.
const double & operator[](size_t i) const
Coordinate access using operator[].
bool isLine() const
Checks whether content is a line.
bool isSegment() const
Checks whether content is a segment.
TObject2D(const TPolygon2D &p)
Implicit constructor from polygon.
TSegment3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from both points.
void getAsPose3D(mrpt::poses::CPose3D &outPose) const
Gets a pose whose XY plane corresponds to this plane.
TObject3D(const TObject3D &obj)
Constructs from another object.
TPose2D()
Default fast constructor.
unsigned char getType() const
Gets object type.
const unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
TPoint2D & operator-=(const TPoint2D &p)
void operator=(const TLine3D &l)
Assigns a line to this object.
double & operator[](size_t i)
Coordinate access using operator[].
TPolygon3D(size_t N)
Constructor for a given size.
void asString(std::string &s) const
Returns a human-readable textual representation of the object as "[x y z qr qx qy qz]".
void operator=(const TLine2D &l)
Assign a line to this object.
bool isPolygon() const
Checks whether content is a polygon.
void destroy()
Destroys the object, releasing the pointer to the content (if any).
TObject3D(const TSegment3D &s)
Constructor from segment.
std::string asString() const
const unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
void getAsPose3DForcingOrigin(const TPoint3D &newOrigin, mrpt::poses::CPose3D &pose)
Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates.
TPose3D(double _x, double _y, double _z, double _yaw, double _pitch, double _roll)
Constructor from coordinates.
XYZ point (double) + Intensity(u8)
TPoint3D operator-(const TPoint3D &p1)
Unary minus operator for 3D points.
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
TObject3D(const TPolygon3D &p)
Constructor from polygon.
double phi
Orientation (rads)
double & operator[](size_t i)
Coordinate access using operator[].
void getAsVector(VECTORLIKE &v) const
Transformation into vector.
2D polygon, inheriting from std::vector<TPoint2D>.
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
3D polygon, inheriting from std::vector<TPoint3D>
Union type storing pointers to every allowed type.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
double & operator[](size_t i)
Coordinate access using operator[].
std::vector< T1 > operator*(const std::vector< T1 > &a, const std::vector< T2 > &b)
a*b (element-wise multiplication)
TPoint3D(const TPoint3Df &p)
Explicit constructor from coordinates.
TPoint2D(const mrpt::utils::TPixelCoordf &p)
Implicit transformation constructor from TPixelCoordf.
bool isPoint() const
Checks whether content is a point.
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
const double & operator[](size_t i) const
Coordinate access using operator[].
TPoint2D & operator/=(double d)
3D line, represented by a base point and a director vector.
TPolygon2D(const std::vector< TPoint2D > &v)
Implicit constructor from a vector of 2D points.
2D line without bounds, represented by its equation .