Go to the documentation of this file.
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"); } }
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;
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;
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;
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];
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);
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;
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;
743 getNormalVector(vector);
754 getDirectorVector(vector);
829 for (
size_t i=0;i<3;i++) vector[i]=director[i];
836 getDirectorVector(vector);
886 return contains(segment.
point1)&&contains(segment.
point2);
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];
1021 void getPlotData(std::vector<double> &x,std::vector<double> &y)
const;
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) {
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 isPoint() const
Checks whether content is a point.
Lightweight 3D point (float version).
#define THROW_EXCEPTION(msg)
double distance(const TPoint3D &point) const
Distance to 3D point.
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
double distance(const TPoint2D &point) const
Distance to a point.
XYZ point (float) + RGB(u8)
void getAsPose2DForcingOrigin(const TPoint2D &origin, mrpt::poses::CPose2D &outPose) const
Get a pose2D whose X axis corresponds to the line, forcing the base point to one given.
TPoint2D & operator+=(const TPoint2D &p)
bool isPolygon() const
Checks whether content is a polygon.
bool contains(const TPoint3D &point) const
Check whether a point is inside the segment.
TPolygon3D()
Default constructor.
void getCenter(TPoint2D &p) const
Segment's central point.
void getDirectorVector(double(&vector)[2]) const
Get line's director vector.
bool isPolygon() const
Checks whether content is a polygon.
void operator=(const TSegment2D &s)
Assign a segment to this object.
bool getSegment(TSegment3D &s) const
Gets the content as a segment, returning false if the type is not adequate.
double norm() const
Point norm.
BASE_IMPEXP ::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrixPtr &pObj)
TPoint3Df(const float xx, const float yy, const float zz)
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45....
static void getPoints(const std::vector< TObject3D > &objs, std::vector< TPoint3D > &pnts)
Static method to retrieve every point included in a vector of objects.
const unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
TPoint2D operator/(double d) const
const TPoint3D & operator[](size_t i) const
Access to points using operator[0-1].
TSegment2D(const TSegment3D &s)
Explicit constructor from 3D object, discarding the z.
const unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
void operator=(const TPoint2D &p)
Assign a point to this object.
bool operator<(const TPoint3D &p) const
void generate2DObject(TSegment2D &s) const
Projection into 2D space, discarding the z.
TPoint3D & operator+=(const TPoint3D &p)
Translation.
static void getPolygons(const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys, std::vector< TObject3D > &remainder)
Static method to retrieve every polygon included in a vector of objects, returning the remaining obje...
bool contains(const TPoint2D &point) const
Check whether a point is inside a segment.
TPlane()
Fast default constructor.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
double phi
Orientation (rads)
const double & operator[](size_t i) const
Coordinate access using operator[].
TPoint3D pBase
Base point.
TPoint2D(double xx, double yy)
Constructor from coordinates.
TLine2D(const TLine3D &l)
Construction from 3D object, discarding the Z.
const unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
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.
static void getPolygons(const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys)
Static method to retrieve every polygon included in a vector of objects.
std::string asString() const
TPoint3D(double xx, double yy, double zz)
Constructor from coordinates.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]",...
double distance(const TPoint2D &point) const
Distance to point.
TPose2D(const TPoint2D &p)
Implicit constructor from TPoint2D.
double length() const
Segment length.
TPointXYZfIu8(float x, float y, float z, uint8_t intensity_val)
static void getLines(const std::vector< TObject3D > &objs, std::vector< TLine3D > &lins)
Static method to retrieve every line included in a vector of objects.
bool contains(const TPoint2D &point) const
Check whether a point is inside the polygon.
static void getPolygons(const std::vector< TObject2D > &objs, std::vector< TPolygon2D > &polys, std::vector< TObject2D > &remainder)
Static method to retrieve all the polygons in a vector of TObject2D, returning the remainder objects ...
bool getPolygon(TPolygon2D &p) const
Gets the content as a polygon, returning false if the type is inadequate.
TPose3D(const TPoint2D &p)
Implicit constructor from TPoint2D.
void getPlotData(std::vector< double > &x, std::vector< double > &y) const
Gets plot data, ready to use on a 2D plot.
double z
X,Y,Z coordinates.
void getUnitaryNormalVector(double(&vector)[2])
Get line's normal vector after unitarizing line.
TPoint2D(const mrpt::utils::TPixelCoordf &p)
Implicit transformation constructor from TPixelCoordf.
const double & operator[](size_t i) const
Coordinate access using operator[].
TPoint2D(const TPose3D &p)
Constructor from TPose3D, discarding z and the angular coordinates.
double distance(const TPoint2D &point) const
Distance from a given point.
void operator=(const TSegment3D &s)
Assigns a segment to this object.
void getCenter(TPoint3D &p) const
Get polygon's central point.
void operator=(const TPoint3D &p)
Assigns a point to this object.
double evaluatePoint(const TPoint2D &point) const
Evaluate point in the line's equation.
bool getPolygon(TPolygon3D &p) const
Gets the content as a polygon, returning false if the type is not adequate.
TPoint3D()
Default fast constructor.
unsigned char getType() const
Gets content type.
TPoint3D(const TPoint2D &p)
Implicit constructor from TPoint2D.
TPointXYZIu8(double x, double y, double z, uint8_t intensity_val)
void getAsPose3D(mrpt::poses::CPose3D &outPose) const
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.
TPoint2D(const mrpt::poses::CPoseOrPoint< DERIVEDCLASS > &p)
Constructor from CPoseOrPoint, perhaps losing 3D information.
Standard type for storing any lightweight 2D type.
bool getSegment(TSegment2D &s) const
Gets the content as a segment, returning false if the type is inadequate.
Union containing pointer to actual data.
Standard object for storing any 3D lightweight object.
TObject3D()
Empty constructor.
TObject2D(const TPoint2D &p)
Implicit constructor from point.
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0....
float & operator[](size_t i)
Coordinate access using operator[].
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static void getPolygons(const std::vector< TObject2D > &objs, std::vector< TPolygon2D > &polys)
Static method to retrieve all the polygons in a vector of TObject2D.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" )
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees)
double & operator[](size_t i)
Coordinate access using operator[].
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
const unsigned char GEOMETRIC_TYPE_LINE
Object type identifier for TLine2D or TLine3D.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
TPose3D(const TPoint3D &p)
Implicit constructor from TPoint3D.
bool isSkew() const
Check whether the polygon is skew.
bool contains(const TLine3D &line) const
Check whether a line is fully contained into the plane.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly, const mrpt::poses::CPose3D &pose)
Static method to create a regular polygon, given its size and radius.
double distance(const TPoint3D &point) const
Distance between the line and a point.
const float & operator[](size_t i) const
Coordinate access using operator[].
TSegment2D()
Fast default constructor.
bool isPoint() const
Checks whether content is a point.
TPoint3D(const mrpt::poses::CPose3D &p)
Constructor from heavyweight 3D pose.
bool getLine(TLine2D &r) const
Gets the content as a line, returning false if the type is inadequate.
TObject3D(const TPlane &p)
Constructor from plane.
TObject2D(const TLine2D &r)
Implicit constructor from line.
TPolygon2D(size_t N)
Constructor for a given number of vertices, intializing them as garbage.
TObject2D(const TObject2D &obj)
Constructor from another TObject2D.
TObject2D()
Implicit constructor from polygon.
void getUnitaryDirectorVector(double(&vector)[3])
Unitarize and then get director vector.
TPoint3D & operator[](size_t i)
Access to points using operator[0-1].
static void getLines(const std::vector< TObject3D > &objs, std::vector< TLine3D > &lins, std::vector< TObject3D > &remainder)
Static method to retrieve every line included in a vector of objects, returning the remaining objects...
TPolygon3D(const TPolygon2D &p)
Constructor from a 2D object.
TPoint3D point1
Origin point.
TObject3D(const TPoint3D &p)
Constructor from point.
Union type storing pointers to every allowed type.
The base template class for 2D & 3D points and poses.
TPlane(const TPoint3D &p1, const TPoint3D &p2, const TPoint3D &p3)
Gets a plane which contains these three points.
bool isConvex() const
Checks whether is convex.
bool isSegment() const
Checks whether content is a segment.
const double & operator[](size_t i) const
Coordinate access using operator[].
void getNormalVector(double(&vector)[2]) const
Get line's normal vector.
TPose2D(const TPose3D &p)
Constructor from TPose3D, losing information.
double distance(const TPoint3D &point) const
Distance to point.
TObject3D & operator=(const TObject3D &obj)
Assigns another object, creating a new pointer if needed.
TPlane(const TPoint3D &p1, const TLine3D &r2)
Gets a plane which contains this point and this line.
void getAsPose2D(mrpt::poses::CPose2D &outPose) const
Get a pose2D whose X axis corresponds to the line.
double & operator[](size_t i)
Coordinate access using operator[].
bool contains(const TPoint3D &point) const
Check whether a point is contained into the plane.
bool contains(const TPoint2D &point) const
Check whether a point is inside the line.
static void getSegments(const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms)
Static method to retrieve all the segments in a vector of TObject2D.
TLine3D()
Fast default constructor.
void generate3DObject(TLine3D &l) const
Project into 3D space, setting the z to 0.
void getCenter(TPoint2D &p) const
Polygon's central point.
TPose3DQuat()
Default fast constructor.
TPose2D(const mrpt::poses::CPose2D &p)
Implicit constructor from heavyweight type.
double distance(const TPoint3D &point) const
Distance to point.
TPoint3D(const TPose3D &p)
Constructor from TPose3D, losing information.
static void getPlanes(const std::vector< TObject3D > &objs, std::vector< TPlane > &plns)
Static method to retrieve every plane included in a vector of objects.
bool getPoint(TPoint3D &p) const
Gets the content as a point, returning false if the type is not adequate.
void getUnitaryNormalVector(double(&vec)[3])
Unitarize, then get normal vector.
void removeRepeatedVertices()
Remove polygon's repeated vertices.
std::string asString() const
TPolygon3D(const std::vector< TPoint3D > &v)
Implicit constructor from a 3D points vector.
double norm() const
Pose's spatial coordinates norm.
TPoint3D point2
Destiny point.
std::vector< T1 > & operator+=(std::vector< T1 > &a, const std::vector< T2 > &b)
a+=b (element-wise sum)
bool isLine() const
Checks whether content is a line.
bool contains(const TSegment3D &segment) const
Check whether a segment is fully contained into the plane.
static void getPlanes(const std::vector< TObject3D > &objs, std::vector< TPlane > &plns, std::vector< TObject3D > &remainder)
Static method to retrieve every plane included in a vector of objects, returning the remaining object...
static void getLines(const std::vector< TObject2D > &objs, std::vector< TLine2D > &lins, std::vector< TObject2D > &remainder)
Static method to retrieve all the lines in a vector of TObject2D, returning the remainder objects in ...
TSegment3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from both points.
TObject2D & operator=(const TObject2D &obj)
Assign another TObject2D.
static void getLines(const std::vector< TObject2D > &objs, std::vector< TLine2D > &lins)
Static method to retrieve all the lines in a vector of TObject2D.
void asString(std::string &s) const
Returns a human-readable textual representation of the object as "[x y z qr qx qy qz]".
TPolygon2D()
Default constructor.
static void getSegments(const std::vector< TObject3D > &objs, std::vector< TSegment3D > &sgms)
Static method to retrieve every segment included in a vector of objects.
XYZ point (double) + RGB(u8)
TPoint3D operator*(double d) const
void generate2DObject(TLine2D &l) const
Project into 2D space, discarding the Z coordinate.
void removeRedundantVertices()
Erase every redundant vertex, thus saving space.
static void getPoints(const std::vector< TObject2D > &objs, std::vector< TPoint2D > &pnts, std::vector< TObject2D > &remainder)
Static method to retrieve all the points in a vector of TObject2D, returning the remainder objects in...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
void generate3DObject(TObject3D &obj) const
Project into 3D space.
double norm() const
Pose's spatial coordinates norm.
void getCenter(TPoint3D &p) const
Segment's central point.
A class used to store a 2D pose.
double signedDistance(const TPoint2D &point) const
Distance with sign to point (sign indicates which side the point is).
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
std::string asString() const
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
TPoint2D operator*(double d) const
TPolygon2D(const std::vector< TPoint2D > &v)
Implicit constructor from a vector of 2D points.
TPose3D(double _x, double _y, double _z, double _yaw, double _pitch, double _roll)
Constructor from coordinates.
static void getPoints(const std::vector< TObject2D > &objs, std::vector< TPoint2D > &pnts)
Static method to retrieve all the points in a vector of TObject2D.
void removeRedundantVertices()
Erase every redundant vertex from the polygon, saving space.
TPolygon2D(const TPolygon3D &p)
Constructor from a 3D object.
TLine2D(const TPoint2D &p1, const TPoint2D &p2)
Constructor from two points, through which the line will pass.
std::string asString() const
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
TPose2D(double xx, double yy, double pphi)
Constructor from coordinates.
TPoint3D operator+(const TPoint3D &p) const
Points addition.
void getAsVector(VECTORLIKE &v) const
Transformation into vector.
void removeRepeatedVertices()
Erase repeated vertices.
TPoint2D(const TPose2D &p)
Constructor from TPose2D, discarding phi.
TPoint2D & operator-=(const TPoint2D &p)
TSegment2D(const TPoint2D &p1, const TPoint2D &p2)
Constructor from both points.
bool contains(const TPoint3D &point) const
Check whether a point is inside the line.
TPoint3D(const mrpt::poses::CPoint3D &p)
Implicit constructor from heavyweight type.
TLine2D(const TSegment2D &s)
Constructor from a segment.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
static void getSegments(const std::vector< TObject3D > &objs, std::vector< TSegment3D > &sgms, std::vector< TObject3D > &remainder)
Static method to retrieve every segment included in a vector of objects, returning the remaining obje...
void operator=(const TPlane &p)
Assigns a plane to this object.
bool isPlane() const
Checks whether content is a plane.
2D polygon, inheriting from std::vector<TPoint2D>.
void generate2DObject(TObject2D &obj) const
Projects into 2D space.
3D polygon, inheriting from std::vector<TPoint3D>
2D segment, consisting of two points.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D &poly, const mrpt::poses::CPose2D &pose)
Static method to create a regular polygon from its size and radius.
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.
TPoint2D(const TPoint3D &p)
Constructor from TPoint3D, discarding z.
struct BASE_IMPEXP TObject3D
std::string asString() const
double z
Translation in x,y,z.
TPoint2D(const mrpt::poses::CPoint2D &p)
Implicit constructor from mrpt::poses::CPoint2D
3D segment, consisting of two points.
TPoint3D operator-(const TPoint3D &p1)
Unary minus operator for 3D points.
TPoint3D & operator*=(const double f)
Point scale.
TLine3D(const TSegment3D &s)
Constructor from 3D segment.
const unsigned char GEOMETRIC_TYPE_PLANE
Object type identifier for TPlane.
struct BASE_IMPEXP TSegment3D
TPoint2D()
Default fast constructor.
double pitch
Pitch coordinate (rotation angle over Y axis).
void generate3DObject(TPolygon3D &p) const
Projects into 3D space, zeroing the z.
static void getPoints(const std::vector< TObject3D > &objs, std::vector< TPoint3D > &pnts, std::vector< TObject3D > &remainder)
Static method to retrieve every point included in a vector of objects, returning the remaining object...
const double & operator[](size_t i) const
Coordinate access using operator[].
void operator=(const TPolygon3D &p)
Assigns a polygon to this object.
unsigned char type
Object type identifier.
unsigned char type
Object type identifier.
3D Plane, represented by its equation
TPoint3D(const TPoint3Df &p)
Explicit constructor from coordinates.
bool operator<(const TSegment2D &s) const
TPoint3D operator-(const TPoint3D &p) const
Points substraction.
bool getLine(TLine3D &r) const
Gets the content as a line, returning false if the type is not adequate.
TPoint2D operator+(const TPoint2D &p) const
void getNormalVector(double(&vec)[3]) const
Get plane's normal vector.
void unitarize()
Unitarize director vector.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D &poly)
Static method to create a regular polygon, given its size and radius.
double sqrDistanceTo(const TPoint3D &p) const
Point-to-point distance, squared.
TPoint2D operator-(const TPoint2D &p) const
TPose3DQuat(const mrpt::poses::CPose3DQuat &p)
Constructor from a CPose3DQuat.
TPose2D(const TPoint3D &p)
Constructor from TPoint3D, losing information.
bool isLine() const
Checks whether content is a line.
const unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
TPose3D()
Default fast constructor.
double yaw
Yaw coordinate (rotation angle over Z axis).
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
TObject2D(const TSegment2D &s)
Implicit constructor from segment.
void operator=(const TPolygon2D &p)
Assign a polygon to this object.
double roll
Roll coordinate (rotation angle over X coordinate).
TPoint3D operator/(double d) const
double qz
Unit quaternion part, qr,qx,qy,qz.
double & operator[](size_t i)
Coordinate access using operator[].
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
double & operator[](size_t i)
Coordinate access using operator[].
void getAsSegmentList(std::vector< TSegment3D > &v) const
Gets as set of segments, instead of set of points.
double distance(const TLine3D &line) const
Distance to 3D line.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
TPoint2D & operator[](size_t i)
Access to points using operator[0-1].
TObject3D(const TLine3D &r)
Constructor from line.
TObject3D(const TPolygon3D &p)
Constructor from polygon.
std::vector< T1 > operator*(const std::vector< T1 > &a, const std::vector< T2 > &b)
a*b (element-wise multiplication)
TLine2D()
Fast default constructor.
void generate2DObject(TPolygon2D &p) const
Projects into a 2D space, discarding the z.
T square(const T x)
Inline function for the square of a number.
const TPoint2D & operator[](size_t i) const
Access to points using operator[0-1].
void getAsPose3D(mrpt::poses::CPose3D &outPose)
Gets a pose whose XY plane corresponds to this plane.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
~TObject2D()
Object destruction.
XYZ point (double) + Intensity(u8)
TPose2D()
Default fast constructor.
void unitarize()
Unitarize line's normal vector.
std::ostream BASE_IMPEXP & operator<<(std::ostream &o, const TPoint2D &p)
TLine3D(const TLine2D &l)
Implicit constructor from 2D object.
void getBestFittingPlane(TPlane &p) const
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.
void unitarize()
Unitarize normal vector.
void destroy()
Destroys the object, releasing the pointer to the content (if any).
TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
This base provides a set of functions for maths stuff.
double evaluatePoint(const TPoint3D &point) const
Evaluate a point in the plane's equation.
2D line without bounds, represented by its equation .
double signedDistance(const TPoint2D &point) const
Distance with sign from a given point (sign indicates side).
void getDirectorVector(double(&vector)[3]) const
Get director vector.
TPoint3D(const TPose2D &p)
Constructor from TPose2D, losing information.
struct mrpt::math::TObject2D::tobject2d_data_t data
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly)
Static method to create a regular polygon, given its size and radius.
3D line, represented by a base point and a director vector.
bool isSegment() const
Checks whether content is a segment.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
A pair (x,y) of pixel coordinates (subpixel resolution).
static void getSegments(const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms, std::vector< TObject2D > &remainder)
Static method to retrieve all the segments in a vector of TObject2D, returning the remainder objects ...
class BASE_IMPEXP TPolygon3D
TObject3D(const TObject3D &obj)
Constructs from another object.
unsigned char getType() const
Gets object type.
double norm() const
Point norm.
TPolygon3D(size_t N)
Constructor for a given size.
bool getPlane(TPlane &p) const
Gets a plane which contains the polygon.
TPoint2D point1
Origin point.
struct mrpt::math::TObject3D::tobject3d_data_t data
void operator=(const TLine3D &l)
Assigns a line to this object.
double & operator[](size_t i)
Coordinate access using operator[].
bool operator<(const TPoint2D &p) const
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04]" )
TPoint2D & operator*=(double d)
TPoint2D point2
Destiny point.
A class used to store a 2D point.
TLine3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from two points, through which the line will pass.
A class used to store a 3D point.
bool operator<(const TSegment3D &s) const
TPointXYZfRGBu8(float x, float y, float z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
double length() const
Segment length.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void operator=(const TLine2D &l)
Assign a line to this object.
TPose3DQuat(double _x, double _y, double _z, double _qr, double _qx, double _qy, double _qz)
Constructor from coordinates.
TLine2D(double A, double B, double C)
Constructor from line's coefficients.
TPlane(const TLine3D &r1, const TLine3D &r2)
Gets a plane which contains the two lines.
void destroy()
Destroys the object and releases the pointer, if any.
XYZ point (float) + Intensity(u8)
TSegment3D()
Fast default constructor.
TPose3D(const TPose2D &p)
Implicit constructor from TPose2D.
const double & operator[](size_t i) const
Coordinate access using operator[].
double distance(const TSegment3D &segment) const
Distance to another segment.
void getUnitaryDirectorVector(double(&vector)[2])
Unitarize line and then get director vector.
TObject3D(const TSegment3D &s)
Constructor from segment.
struct BASE_IMPEXP TLine3D
TPoint2D & operator/=(double d)
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
TObject2D(const TPolygon2D &p)
Implicit constructor from polygon.
void getAsSegmentList(std::vector< TSegment2D > &v) const
Gets as set of segments, instead of points.
TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
bool contains(const TPoint3D &point) const
Check whether a point is inside the polygon.
bool getPoint(TPoint2D &p) const
Gets the content as a point, returning false if the type is inadequate.
TPose3D(const mrpt::poses::CPose3D &p)
Implicit constructor from heavyweight type.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
TSegment3D(const TSegment2D &s)
Constructor from 2D object.
void generate3DObject(TSegment3D &s) const
Project into 3D space, setting the z to 0.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |