9 #ifndef LIGHTWEIGHT_GEOM_DATA_H 10 #define LIGHTWEIGHT_GEOM_DATA_H 28 namespace utils {
class CStream; }
81 template <
class DERIVEDCLASS>
92 inline TPoint2D(
double xx,
double yy):x(xx),y(yy) {}
172 void fromString(
const std::string &s);
173 static size_t size() {
return 2; }
219 inline TPose2D(
double xx,
double yy,
double pphi):x(xx),y(yy),phi(pphi) {}
241 v[0]=x; v[1]=y; v[2]=phi;
253 void fromString(
const std::string &s);
254 static size_t size() {
return 3; }
257 #pragma pack(pop) // NOTE: Don't force TPoint3Df to be mem aligned (may break CPU mem access alignment in ARM) 269 inline TPoint3Df(
const float xx,
const float yy,
const float zz) : x(xx), y(yy),z(zz) { }
274 #pragma pack(push,1) //Pragma defined to ensure no structure packing 285 inline TPoint3D(
double xx,
double yy,
double zz):x(xx),y(yy),z(zz) {}
357 v[0]=x; v[1]=y; v[2]=z;
410 void fromString(
const std::string &s);
411 static size_t size() {
return 3; }
466 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) {}
494 v[0]=x; v[1]=y; v[2]=z; v[3]=yaw; v[4]=pitch; v[5]=roll;
506 void fromString(
const std::string &s);
507 static size_t size() {
return 6; }
523 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) { }
544 for (
size_t i=0;i<7;i++) v[i]=(*
this)[i];
556 void fromString(
const std::string &s);
557 static size_t size() {
return 7; }
579 return (p1.
x==p2.
x)&&(p1.
y==p2.
y);
585 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y);
591 return (p1.
x==p2.
x)&&(p1.
y==p2.
y)&&(p1.
z==p2.
z);
597 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y)||(p1.
z!=p2.
z);
648 double length()
const;
656 double signedDistance(
const TPoint2D &point)
const;
660 bool contains(
const TPoint2D &point)
const;
681 p.
x=(point1.
x+point2.
x)/2;
682 p.
y=(point1.
y+point2.
y)/2;
716 double length()
const;
728 bool contains(
const TPoint3D &point)
const;
751 p.
x=(point1.
x+point2.
x)/2;
752 p.
y=(point1.
y+point2.
y)/2;
753 p.
z=(point1.
z+point2.
z)/2;
801 double evaluatePoint(
const TPoint2D &point)
const;
805 bool contains(
const TPoint2D &point)
const;
813 double signedDistance(
const TPoint2D &point)
const;
817 void getNormalVector(
double (&vector)[2])
const;
827 getNormalVector(vector);
832 void getDirectorVector(
double (&vector)[2])
const;
838 getDirectorVector(vector);
843 void generate3DObject(
TLine3D &l)
const;
900 bool contains(
const TPoint3D &point)
const;
913 for (
size_t i=0;i<3;i++) vector[i]=director[i];
920 getDirectorVector(vector);
961 double evaluatePoint(
const TPoint3D &point)
const;
965 bool contains(
const TPoint3D &point)
const;
970 return contains(segment.
point1)&&contains(segment.
point2);
975 bool contains(
const TLine3D &line)
const;
987 void getNormalVector(
double (&vec)[3])
const;
997 getNormalVector(vec);
1045 inline TPlane(
double A,
double B,
double C,
double D) {
1055 for (
size_t i=0;i<4;i++) coefs[i]=vec[i];
1074 bool contains(
const TPoint2D &point)
const;
1078 void getAsSegmentList(std::vector<TSegment2D> &v)
const;
1090 bool isConvex()
const;
1095 void removeRepeatedVertices();
1100 void removeRedundantVertices();
1105 void getPlotData(std::vector<double> &x,std::vector<double> &y)
const;
1126 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon2D &poly);
1147 bool contains(
const TPoint3D &point)
const;
1151 void getAsSegmentList(std::vector<TSegment3D> &v)
const;
1155 bool getPlane(
TPlane &p)
const;
1160 void getBestFittingPlane(
TPlane &p)
const;
1176 bool isSkew()
const;
1180 void removeRepeatedVertices();
1184 void removeRedundantVertices();
1205 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon3D &poly);
1248 #ifdef TOBJECTS_USE_UNIONS 1273 delete data.segment;
1279 delete data.polygon;
1322 inline bool isPoint()
const {
1328 inline bool isSegment()
const {
1334 inline bool isLine()
const {
1340 inline bool isPolygon()
const {
1346 inline unsigned char getType()
const {
1352 inline bool getPoint(
TPoint2D &p)
const {
1356 }
else return false;
1361 inline bool getSegment(
TSegment2D &s)
const {
1365 }
else return false;
1370 inline bool getLine(
TLine2D &r)
const {
1374 }
else return false;
1379 inline bool getPolygon(
TPolygon2D &p)
const {
1383 }
else return false;
1389 if (
this==&obj)
return;
1391 switch (type=obj.
type) {
1409 inline void operator=(
const TPoint2D &p) {
1425 inline void operator=(
const TLine2D &l) {
1441 void generate3DObject(
TObject3D &obj)
const;
1451 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts);
1455 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms);
1459 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins);
1463 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys);
1467 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts,std::vector<TObject2D> &remainder);
1471 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms,std::vector<TObject2D> &remainder);
1475 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins,std::vector<TObject2D> &remainder);
1479 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys,std::vector<TObject2D> &remainder);
1510 delete data.segment;
1516 delete data.polygon;
1533 data.point=
new TPoint3D(p);
1557 data.plane=
new TPlane(p);
1572 inline bool isPoint()
const {
1578 inline bool isSegment()
const {
1584 inline bool isLine()
const {
1590 inline bool isPolygon()
const {
1596 inline bool isPlane()
const {
1602 inline unsigned char getType()
const {
1608 inline bool getPoint(TPoint3D &p)
const {
1612 }
else return false;
1617 inline bool getSegment(
TSegment3D &s)
const {
1621 }
else return false;
1626 inline bool getLine(
TLine3D &r)
const {
1630 }
else return false;
1635 inline bool getPolygon(
TPolygon3D &p)
const {
1639 }
else return false;
1644 inline bool getPlane(TPlane &p)
const {
1648 }
else return false;
1654 if (
this==&obj)
return;
1656 switch (type=obj.type) {
1658 data.point=
new TPoint3D(*(obj.data.point));
1661 data.segment=
new TSegment3D(*(obj.data.segment));
1664 data.line=
new TLine3D(*(obj.data.line));
1667 data.polygon=
new TPolygon3D(*(obj.data.polygon));
1670 data.plane=
new TPlane(*(obj.data.plane));
1681 inline void operator=(
const TPoint3D &p) {
1684 data.point=
new TPoint3D(p);
1697 inline void operator=(
const TLine3D &l) {
1713 inline void operator=(
const TPlane &p) {
1716 data.plane=
new TPlane(p);
1722 inline void generate2DObject(TObject2D &obj)
const {
1725 obj=TPoint2D(*(data.point));
1728 obj=TSegment2D(*(data.segment));
1731 obj=TLine2D(*(data.line));
1734 obj=TPolygon2D(*(data.polygon));
1737 throw std::logic_error(
"Too many dimensions");
1752 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts);
1756 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms);
1760 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins);
1764 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns);
1768 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys);
1772 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts,std::vector<TObject3D> &remainder);
1776 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms,std::vector<TObject3D> &remainder);
1780 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins,std::vector<TObject3D> &remainder);
1784 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns,std::vector<TObject3D> &remainder);
1788 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys,std::vector<TObject3D> &remainder);
1885 }
else return false;
1894 }
else return false;
1903 }
else return false;
1912 }
else return false;
1918 if (
this==&obj)
return;
1920 switch (type=obj.
type) {
1970 void generate3DObject(
TObject3D &obj)
const;
1980 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts);
1984 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms);
1988 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins);
1992 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys);
1996 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts,std::vector<TObject2D> &remainder);
2000 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms,std::vector<TObject2D> &remainder);
2004 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins,std::vector<TObject2D> &remainder);
2008 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys,std::vector<TObject2D> &remainder);
2121 }
else return false;
2130 }
else return false;
2139 }
else return false;
2148 }
else return false;
2157 }
else return false;
2163 if (
this==&obj)
return;
2165 switch (type=obj.
type) {
2246 throw std::logic_error(
"Too many dimensions");
2261 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts);
2265 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms);
2269 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins);
2273 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns);
2277 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys);
2281 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts,std::vector<TObject3D> &remainder);
2285 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms,std::vector<TObject3D> &remainder);
2289 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins,std::vector<TObject3D> &remainder);
2293 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns,std::vector<TObject3D> &remainder);
2297 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)
void getAsVector(vector_double &v) const
Transformation into vector.
double & operator[](size_t i)
Unsafe coordinate access using operator[].
double qx
Quaternion part, x.
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
bool getPolygon(TPolygon2D &p) const
Gets the content as a polygon, returning false if the type is inadequate.
TPoint2D & operator*=(double d)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
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]" ) ...
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.
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.
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.
void operator=(const TSegment2D &s)
Assign a segment to this object.
std::string asString() const
class BASE_IMPEXP CStream
TPoint3D()
Default fast constructor.
TPoint3D operator+(const TPoint3D &p) const
Points addition.
Standard type for storing any lightweight 2D type.
struct mrpt::math::TObject3D::@4 data
Union containing pointer to actual data.
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.
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)
Unsafe coordinate access using operator[].
double qy
Quaternion part, y.
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.
void getAsVector(vector_double &v) const
Transformation into vector.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
void getAsVector(vector_double &v) const
Gets the pose as a vector of doubles.
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.
The base class of MRPT vectors, actually, Eigen column matrices of dynamic size with specialized cons...
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
3D segment, consisting of two points.
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
Unsafe coordinate access using operator[].
TPoint3D point2
Destiny point.
void getAsVector(vector_double &v) const
Transformation into vector.
std::string asString() const
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
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 z.
const double & operator[](size_t i) const
Unsafe coordinate access using operator[].
double x
Translation in x.
const unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
const TPoint3D & operator[](size_t i) const
Unsafe point access using [] operator, intended for loops.
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
TPoint3D operator/(double d) const
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.
double coefs[3]
Line coefficients, stored as an array: .
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,qz).
bool isSegment() const
Checks whether content is a segment.
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)
Unsafe point access using [] operator, intended for loops.
double qz
Quaternion part, z.
bool isPlane() const
Checks whether content is a plane.
double qr
Quaternion part, r.
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.
void getAsVector(vector_double &v) const
Gets the pose as a vector of doubles.
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 ).
double director[3]
Director vector.
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)
void resize(const size_t N, const T default_val)
Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...
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
Unsafe 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.8]" )
double y
Translation in y.
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.
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.
double coefs[4]
Plane coefficients, stored as an array: .
TSegment2D()
Fast default constructor.
unsigned char type
Object type identifier.
~TObject2D()
Object destruction.
const TPoint2D & operator[](size_t i) const
Unsafe point access using [] operator, intended for loops.
TPoint3D & operator[](size_t i)
Unsafe point access using [] operator, intended for loops.
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.
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
Unsafe 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.
struct mrpt::math::TObject2D::@3 data
Union type storing pointers to every allowed type.
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.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees) ...
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)
Unsafe 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 operator=(const TObject3D &obj)
Assigns another object, creating a new pointer if needed.
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.
TPoint3D operator-(const TPoint3D &p1)
Unary minus operator for 3D points.
TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
TObject3D(const TPolygon3D &p)
Constructor from polygon.
double phi
Phi coordinate.
double & operator[](size_t i)
Unsafe coordinate access using operator[].
2D polygon, inheriting from std::vector<TPoint2D>.
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
3D polygon, inheriting from std::vector<TPoint3D>
double & operator[](size_t i)
Unsafe 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.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]"...
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
Unsafe coordinate access using operator[].
TPoint2D & operator/=(double d)
void operator=(const TObject2D &obj)
Assign another TObject2D.
#define MRPT_DECLARE_TTYPENAME(_TYPE)
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 .