9 #ifndef LIGHTWEIGHT_GEOM_DATA_H 10 #define LIGHTWEIGHT_GEOM_DATA_H 13 #include <mrpt/config.h> 54 template <
class DERIVEDCLASS>
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"); } }
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;
199 const double ccos = ::cos(phi), csin=::sin(phi);
200 g.x =
x+ l.
x * ccos - l.
y * csin;
201 g.y =
y+ l.
x * csin + l.
y * ccos;
204 const double Ax =
g.x -
x, Ay =
g.y -
y, ccos = ::cos(phi), csin=::sin(phi);
205 l.
x = Ax * ccos + Ay * csin;
206 l.
y =-Ax * csin + Ay * ccos;
218 static size_t size() {
return 3; }
232 inline TPoint3Df(
const float xx,
const float yy,
const float zz) :
x(xx),
y(yy),
z(zz) { }
236 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"); } }
239 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"); } }
251 inline TPoint3D(
double xx,
double yy,
double zz):
x(xx),
y(yy),
z(zz) {}
282 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"); } }
284 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"); } }
313 template <
class VECTORLIKE>
370 static size_t size() {
return 3; }
385 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) {}
399 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) {}
434 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) {}
440 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"); } }
442 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"); } }
467 void getAsQuaternion(
477 static size_t size() {
return 6; }
489 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) { }
496 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"); } }
498 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"); } }
506 for (
size_t i=0;i<7;i++)
v[i]=(*
this)[i];
519 static size_t size() {
return 7; }
540 return (p1.
x==p2.
x)&&(p1.
y==p2.
y);
546 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y);
552 return (p1.
x==p2.
x)&&(p1.
y==p2.
y)&&(p1.
z==p2.
z);
558 return (p1.
x!=p2.
x)||(p1.
y!=p2.
y)||(p1.
z!=p2.
z);
616 double signedDistance(
const TPoint2D &point)
const;
620 bool contains(
const TPoint2D &point)
const;
622 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"); } }
624 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"); } }
633 p.x=(point1.
x+point2.
x)/2;
634 p.y=(point1.
y+point2.
y)/2;
680 bool contains(
const TPoint3D &point)
const;
682 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"); } }
684 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"); } }
695 p.x=(point1.
x+point2.
x)/2;
696 p.y=(point1.
y+point2.
y)/2;
697 p.z=(point1.
z+point2.
z)/2;
744 double evaluatePoint(
const TPoint2D &point)
const;
748 bool contains(
const TPoint2D &point)
const;
756 double signedDistance(
const TPoint2D &point)
const;
760 void getNormalVector(
double (&vector)[2])
const;
770 getNormalVector(vector);
775 void getDirectorVector(
double (&vector)[2])
const;
781 getDirectorVector(vector);
786 void generate3DObject(
TLine3D &l)
const;
843 bool contains(
const TPoint3D &point)
const;
856 for (
size_t i=0;i<3;i++) vector[i]=director[i];
863 getDirectorVector(vector);
902 double evaluatePoint(
const TPoint3D &point)
const;
906 bool contains(
const TPoint3D &point)
const;
911 return contains(segment.
point1)&&contains(segment.
point2);
916 bool contains(
const TLine3D &line)
const;
928 void getNormalVector(
double (&vec)[3])
const;
938 getNormalVector(vec);
986 inline TPlane(
double A,
double B,
double C,
double D) {
996 for (
size_t i=0;i<4;i++) coefs[i]=vec[i];
1009 bool contains(
const TPoint2D &point)
const;
1010 void getAsSegmentList(std::vector<TSegment2D> &
v)
const;
1013 bool isConvex()
const;
1014 void removeRepeatedVertices();
1015 void removeRedundantVertices();
1016 void getPlotData(std::vector<double> &
x,std::vector<double> &
y)
const;
1029 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon2D &poly);
1043 bool contains(
const TPoint3D &point)
const;
1044 void getAsSegmentList(std::vector<TSegment3D> &
v)
const;
1045 bool getPlane(
TPlane &
p)
const;
1047 void getBestFittingPlane(
TPlane &
p)
const;
1053 bool isSkew()
const;
1054 void removeRepeatedVertices();
1055 void removeRedundantVertices();
1066 static void createRegularPolygon(
size_t numEdges,
double radius,
TPolygon3D &poly);
1204 }
else return false;
1213 }
else return false;
1222 }
else return false;
1231 }
else return false;
1237 if (
this==&
obj)
return *
this;
1244 data.segment=
obj.data.segment;
1300 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts);
1304 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms);
1308 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins);
1312 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys);
1316 static void getPoints(
const std::vector<TObject2D> &objs,std::vector<TPoint2D> &pnts,std::vector<TObject2D> &remainder);
1320 static void getSegments(
const std::vector<TObject2D> &objs,std::vector<TSegment2D> &sgms,std::vector<TObject2D> &remainder);
1324 static void getLines(
const std::vector<TObject2D> &objs,std::vector<TLine2D> &lins,std::vector<TObject2D> &remainder);
1328 static void getPolygons(
const std::vector<TObject2D> &objs,std::vector<TPolygon2D> &polys,std::vector<TObject2D> &remainder);
1443 }
else return false;
1452 }
else return false;
1461 }
else return false;
1470 }
else return false;
1479 }
else return false;
1485 if (
this==&
obj)
return *
this;
1492 data.segment=
obj.data.segment;
1569 throw std::logic_error(
"Too many dimensions");
1584 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts);
1588 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms);
1592 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins);
1596 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns);
1600 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys);
1604 static void getPoints(
const std::vector<TObject3D> &objs,std::vector<TPoint3D> &pnts,std::vector<TObject3D> &remainder);
1608 static void getSegments(
const std::vector<TObject3D> &objs,std::vector<TSegment3D> &sgms,std::vector<TObject3D> &remainder);
1612 static void getLines(
const std::vector<TObject3D> &objs,std::vector<TLine3D> &lins,std::vector<TObject3D> &remainder);
1616 static void getPlanes(
const std::vector<TObject3D> &objs,std::vector<TPlane> &plns,std::vector<TObject3D> &remainder);
1620 static void getPolygons(
const std::vector<TObject3D> &objs,std::vector<TPolygon3D> &polys,std::vector<TObject3D> &remainder);
1632 inline TTwist2D(
double vx_,
double vy_,
double omega_):vx(vx_),vy(vy_),omega(omega_) {}
1636 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return vx;
case 1:
return vy;
case 2:
return omega;
default:
throw std::out_of_range(
"index out of range"); } }
1638 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return vx;
case 1:
return vy;
case 2:
return omega;
default:
throw std::out_of_range(
"index out of range"); } }
1642 v[0]=vx;
v[1]=vy;
v[2]=omega;
1645 void rotate(
const double ang);
1672 inline TTwist3D(
double vx_,
double vy_,
double vz_,
double wx_,
double wy_,
double wz_):vx(vx_),vy(vy_),vz(vz_),wx(wx_),wy(wy_),wz(wz_) {}
1676 inline double &
operator[](
size_t i) {
switch (i) {
case 0:
return vx;
case 1:
return vy;
case 2:
return vz;
case 3:
return wx;
case 4:
return wy;
case 5:
return wz;
default:
throw std::out_of_range(
"index out of range"); } }
1678 inline const double &
operator[](
size_t i)
const {
switch (i) {
case 0:
return vx;
case 1:
return vy;
case 2:
return vz;
case 3:
return wx;
case 4:
return wy;
case 5:
return wz;
default:
throw std::out_of_range(
"index out of range"); } }
1682 for (
int i=0;i<6;i++)
v[i]=(*
this)[i];
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)
const double & operator[](size_t i) const
Coordinate access using operator[].
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.
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
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.
double norm() const
Returns the norm of the (x,y) vector (phi is not used)
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.
void composePoint(const TPoint2D l, TPoint2D &g) const
double wz
Angular velocity (rad/s)
void getPlanes(const std::vector< TPolygon3D > &polys, std::vector< TPlane > &planes)
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)
TPolygon3D()
Default constructor.
#define THROW_EXCEPTION(msg)
GLdouble GLdouble GLdouble GLdouble q
bool operator!=(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
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.
TTwist3D()
Default fast constructor.
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.
TTwist2D(double vx_, double vy_, double omega_)
Constructor from components.
double vz
Velocity components: X,Y (m/s)
void operator=(const TPoint3D &p)
Assigns a point to this object.
TPose2D(double xx, double yy, double pphi)
Constructor from coordinates.
GLsizei GLsizei GLuint * obj
TSegment3D(const TSegment2D &s)
Constructor from 2D object.
double & operator[](size_t i)
Coordinate access using operator[].
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[].
3D twist: 3D velocity vector (vx,vy,vz) + angular velocity (wx,wy,wz)
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.
T square(const T x)
Inline function for the square of a number.
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.
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
std::vector< T1 > operator+(const std::vector< T1 > &a, const std::vector< T2 > &b)
a+b (element-wise sum)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
std::string asString() const
A numeric matrix of compile-time fixed size.
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.
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
std::ostream BASE_IMPEXP & operator<<(std::ostream &o, const TPoint2D &p)
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
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].
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
double vy
Velocity components: X,Y (m/s)
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,qz).
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.
GLsizei const GLchar ** string
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.
double & operator[](size_t i)
Coordinate access using operator[].
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.
TPoint3D & operator*=(const double f)
Point scale.
BASE_IMPEXP ::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrixPtr &pObj)
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.8]" )
std::string asString() const
GLdouble GLdouble GLdouble r
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, including the 2D coordinate point and a heading (phi) angle...
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.
GLuint GLsizei GLsizei * length
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].
T hypot_fast(const T x, const T y)
Faster version of std::hypot(), to use when overflow is not an issue and we prefer fast code...
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.
const double & operator[](size_t i) const
Coordinate access using operator[].
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.
TTwist3D(double vx_, double vy_, double vz_, double wx_, double wy_, double wz_)
Constructor from components.
bool operator<(const CPoint< DERIVEDCLASS > &a, const CPoint< DERIVEDCLASS > &b)
Used by STL algorithms.
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[].
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ...
void inverseComposePoint(const TPoint2D g, TPoint2D &l) const
void getAsVector(std::vector< double > &v) const
Transformation into vector.
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
TTwist2D()
Default fast constructor.
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)
GLsizei GLsizei GLenum GLenum const GLvoid * data
std::string asString() const
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.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
TObject3D(const TPolygon3D &p)
Constructor from polygon.
double phi
Orientation (rads)
GLuint GLuint GLsizei GLenum type
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>
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Union type storing pointers to every allowed type.
double omega
Angular velocity (rad/s)
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.
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 .