9 #ifndef LIGHTWEIGHT_GEOM_DATA_H 10 #define LIGHTWEIGHT_GEOM_DATA_H 13 #include <mrpt/config.h> 60 template <
class DERIVEDCLASS>
88 throw std::out_of_range(
"index out of range");
101 throw std::out_of_range(
"index out of range");
185 static size_t size() {
return 2; }
228 inline TPose2D(
double xx,
double yy,
double pphi) :
x(xx),
y(yy),
phi(pphi)
247 throw std::out_of_range(
"index out of range");
262 throw std::out_of_range(
"index out of range");
293 const double ccos = ::cos(
phi), csin = ::sin(
phi);
294 g.x =
x + l.
x * ccos - l.
y * csin;
295 g.y =
y + l.
x * csin + l.
y * ccos;
299 const double Ax =
g.x -
x, Ay =
g.y -
y, ccos = ::cos(
phi),
301 l.
x = Ax * ccos + Ay * csin;
302 l.
y = -Ax * csin + Ay * ccos;
312 static size_t size() {
return 3; }
329 inline TPoint3Df(
const float xx,
const float yy,
const float zz)
330 :
x(xx),
y(yy),
z(zz)
356 throw std::out_of_range(
"index out of range");
372 throw std::out_of_range(
"index out of range");
391 inline TPoint3D(
double xx,
double yy,
double zz) :
x(xx),
y(yy),
z(zz) {}
432 throw std::out_of_range(
"index out of range");
447 throw std::out_of_range(
"index out of range");
484 template <
class VECTORLIKE>
560 static size_t size() {
return 3; }
583 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
606 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
655 double _x,
double _y,
double _z,
double _yaw,
double _pitch,
682 throw std::out_of_range(
"index out of range");
703 throw std::out_of_range(
"index out of range");
760 static size_t size() {
return 6; }
780 double _x,
double _y,
double _z,
double _qr,
double _qx,
double _qy,
782 :
x(_x),
y(_y),
z(_z),
qr(_qr),
qx(_qx),
qy(_qy),
qz(_qz)
810 throw std::out_of_range(
"index out of range");
833 throw std::out_of_range(
"index out of range");
842 for (
size_t i = 0; i < 7; i++)
v[i] = (*
this)[i];
865 static size_t size() {
return 7; }
869 std::ostream&
operator<<(std::ostream& o,
const TPoint2D&
p);
870 std::ostream&
operator<<(std::ostream& o,
const TPoint3D&
p);
871 std::ostream&
operator<<(std::ostream& o,
const TPose2D&
p);
872 std::ostream&
operator<<(std::ostream& o,
const TPose3D&
p);
873 std::ostream&
operator<<(std::ostream& o,
const TPose3DQuat&
p);
887 return (p1.
x == p2.
x) && (p1.
y == p2.
y);
894 return (p1.
x != p2.
x) || (p1.
y != p2.
y);
901 return (p1.
x == p2.
x) && (p1.
y == p2.
y) && (p1.
z == p2.
z);
908 return (p1.
x != p2.
x) || (p1.
y != p2.
y) || (p1.
z != p2.
z);
915 return (p1.
x == p2.
x) && (p1.
y == p2.
y) &&
924 return (p1.
x != p2.
x) || (p1.
y != p2.
y) ||
933 return (p1.
x == p2.
x) && (p1.
y == p2.
y) && (p1.
z == p2.
z) &&
945 return (p1.
x != p2.
x) || (p1.
y != p2.
y) || (p1.
z != p2.
z) ||
1000 throw std::out_of_range(
"index out of range");
1013 throw std::out_of_range(
"index out of range");
1086 throw std::out_of_range(
"index out of range");
1099 throw std::out_of_range(
"index out of range");
1289 for (
size_t i = 0; i < 3; i++) vector[i] =
director[i];
1429 inline TPlane(
double A,
double B,
double C,
double D)
1441 for (
size_t i = 0; i < 4; i++)
coefs[i] = vec[i];
1474 void getPlotData(std::vector<double>&
x, std::vector<double>&
y)
const;
1491 size_t numEdges,
double radius,
TPolygon2D& poly);
1498 size_t numEdges,
double radius,
TPolygon2D& poly,
1546 size_t numEdges,
double radius,
TPolygon3D& poly);
1553 size_t numEdges,
double radius,
TPolygon3D& poly,
1726 p = *(
data.polygon);
1737 if (
this == &
obj)
return *
this;
1745 data.segment =
obj.data.segment;
1807 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts);
1812 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms);
1817 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins);
1822 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys);
1828 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts,
1829 std::vector<TObject2D>& remainder);
1835 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms,
1836 std::vector<TObject2D>& remainder);
1842 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins,
1843 std::vector<TObject2D>& remainder);
1849 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys,
1850 std::vector<TObject2D>& remainder);
1997 p = *(
data.polygon);
2022 if (
this == &
obj)
return *
this;
2030 data.segment =
obj.data.segment;
2115 throw std::logic_error(
"Too many dimensions");
2132 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts);
2137 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms);
2142 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins);
2147 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns);
2152 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys);
2158 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts,
2159 std::vector<TObject3D>& remainder);
2165 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms,
2166 std::vector<TObject3D>& remainder);
2172 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins,
2173 std::vector<TObject3D>& remainder);
2179 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns,
2180 std::vector<TObject3D>& remainder);
2186 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys,
2187 std::vector<TObject3D>& remainder);
2223 throw std::out_of_range(
"index out of range");
2238 throw std::out_of_range(
"index out of range");
2251 void rotate(
const double ang);
2294 double vx_,
double vy_,
double vz_,
double wx_,
double wy_,
double wz_)
2318 throw std::out_of_range(
"index out of range");
2339 throw std::out_of_range(
"index out of range");
2346 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.
static void getSegments(const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms)
Static method to retrieve all the segments in a vector of TObject2D.
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.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly)
Static method to create a regular polygon, given its size and radius.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D &poly)
Static method to create a regular polygon, given its size and radius.
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" ) ...
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)
void rotate(const double ang)
Transform the (vx,vy) components for a counterclockwise rotation of ang radians.
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)
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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
bool operator==(const TTwist3D &o) const
double distance(const TPoint3D &point) const
Distance between the line and a point.
void getPlotData(std::vector< double > &x, std::vector< double > &y) const
Gets plot data, ready to use on a 2D plot.
TObject2D(const TPoint2D &p)
Implicit constructor from point.
TPoint3Df(const float xx, const float yy, const float zz)
bool isSkew() const
Check whether the polygon is skew.
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 TPoint2D &point) const
Check whether a point is inside a segment.
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.
static void getPolygons(const std::vector< TObject2D > &objs, std::vector< TPolygon2D > &polys)
Static method to retrieve all the polygons in a vector of TObject2D.
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.
double distance(const TPoint2D &point) const
Distance to point.
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 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.
void getAsQuaternion(mrpt::math::CQuaternion< double > &q, mrpt::math::CMatrixFixedNumeric< double, 4, 3 > *out_dq_dr=NULL) const
Returns the quaternion associated to the rotation of this object (NOTE: XYZ translation is ignored) ...
TPoint3D()
Default fast constructor.
TPoint3D operator+(const TPoint3D &p) const
Points addition.
double signedDistance(const TPoint2D &point) const
Distance with sign from a given point (sign indicates side).
TPoint3Df & operator+=(const TPoint3Df &p)
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.
void getAsSegmentList(std::vector< TSegment2D > &v) const
Gets as set of segments, instead of points.
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.
bool contains(const TPoint2D &point) const
Check whether a point is inside the line.
TSegment3D()
Fast default constructor.
void removeRepeatedVertices()
Erase repeated vertices.
double signedDistance(const TPoint2D &point) const
Distance with sign to point (sign indicates which side the point is).
void generate3DObject(TLine3D &l) const
Project into 3D space, setting the z to 0.
TObject3D()
Empty constructor.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45...
double distance(const TPoint3D &point) const
Distance to 3D point.
TPoint3D & operator+=(const TPoint3D &p)
Translation.
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.
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.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[vx vy vz wx wy wz]" ) ...
double & operator[](size_t i)
Coordinate access using operator[].
double norm() const
Pose's spatial coordinates norm.
bool operator<(const TSegment3D &s) const
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.
static void getSegments(const std::vector< TObject3D > &objs, std::vector< TSegment3D > &sgms)
Static method to retrieve every segment included in a vector of objects.
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)
void getNormalVector(double(&vector)[2]) const
Get line's normal vector.
void generate3DObject(TPolygon3D &p) const
Projects into 3D space, zeroing the z.
bool contains(const TPoint3D &point) const
Check whether a point is inside the line.
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...
void unitarize()
Unitarize line's normal vector.
std::string asString() const
void getBoundingBox(TPoint2D &min_coords, TPoint2D &max_coords) const
Get polygon bounding box.
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.
double distance(const TPoint3D &point) const
Distance to point.
struct mrpt::math::TObject2D::tobject2d_data_t data
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45...
3D segment, consisting of two points.
double length() const
Segment length.
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.
bool operator<(const TSegment2D &s) const
float & operator[](size_t i)
Coordinate access using operator[].
std::string asString() const
std::ostream & operator<<(std::ostream &o, const TPoint2D &p)
double vx
Velocity components: X,Y (m/s)
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
TObject3D & operator=(const TObject3D &obj)
Assigns another object, creating a new pointer if needed.
mrpt::math::TPose2D operator+(const mrpt::math::TPose2D &b) const
Operator "oplus" pose composition: "ret=this \oplus b".
TLine2D(double A, double B, double C)
Constructor from line's coefficients.
void rotate(const mrpt::poses::CPose3D &rot)
Transform all 6 components for a change of reference frame from "A" to another frame "B" whose rotati...
static void getLines(const std::vector< TObject3D > &objs, std::vector< TLine3D > &lins)
Static method to retrieve every line included in a vector of objects.
const double & operator[](size_t i) const
Coordinate access using operator[].
void unitarize()
Unitarize normal vector.
mrpt::math::TPose2D operator*(const double dt) const
Returns the pose increment of multiplying each twist component times "dt" seconds.
double x
Translation in x,y,z.
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.
static void getPolygons(const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys)
Static method to retrieve every polygon included in a vector of objects.
3D Plane, represented by its equation
void getDirectorVector(double(&vector)[3]) const
Get director vector.
bool getPlane(TPlane &p) const
Gets a plane which contains the polygon.
double coefs[3]
Line coefficients, stored as an array: .
TPoint2D operator*(double d) const
TPolygon2D()
Default constructor.
double x
X,Y,Z coordinates.
void operator=(const TPolygon3D &p)
Assigns a polygon to this object.
void removeRedundantVertices()
Erase every redundant vertex, thus saving space.
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.
TPoint2D & operator[](size_t i)
Access to points using operator[0-1].
void getCenter(TPoint2D &p) const
Polygon's central point.
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
TObject2D & operator=(const TObject2D &obj)
Assign another TObject2D.
bool isPlane() const
Checks whether content is a plane.
GLsizei const GLchar ** string
double qr
Unit quaternion part, qr,qx,qy,qz.
A class used to store a 2D point.
A class used to store a 3D point.
void unitarize()
Unitarize director vector.
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 contains(const TPoint3D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
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 ).
double distance(const TPoint3D &point) const
Distance to point (always >=0)
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.
bool isConvex() const
Checks whether is convex.
TPoint2D()
Default fast constructor.
mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrix::Ptr &pObj)
void generate3DObject(TSegment3D &s) const
Project into 3D space, setting the z to 0.
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
TPoint3D & operator*=(const double f)
Point scale.
double distance(const TPoint2D &point) const
Distance to a point (always >=0)
void getAsPose2D(mrpt::poses::CPose2D &outPose) const
Get a pose2D whose X axis corresponds to the line.
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]" )
double wx
Angular velocity (rad/s)
std::string asString() const
GLdouble GLdouble GLdouble r
double vx
Velocity components: X,Y (m/s)
TPose3DQuat(double _x, double _y, double _z, double _qr, double _qx, double _qy, double _qz)
Constructor from coordinates.
void generate3DObject(TObject3D &obj) const
Project into 3D space.
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).
double sqrDistanceTo(const TPoint3D &p) const
Point-to-point distance, squared.
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 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.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
struct mrpt::math::TObject3D::tobject3d_data_t data
bool operator!=(const TTwist3D &o) const
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).
void removeRedundantVertices()
Erase every redundant vertex from the polygon, saving space.
void removeRepeatedVertices()
Remove polygon's repeated vertices.
bool contains(const TPoint3D &point) const
Check whether a point is inside the segment.
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.
double evaluatePoint(const TPoint3D &point) const
Evaluate a point in the plane's equation.
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 fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
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 operator<(const TPoint3D &p) const
double evaluatePoint(const TPoint2D &point) const
Evaluate point in the line's equation.
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.
TSegment3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from both points.
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.
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)
mrpt::math::TPose2D operator-(const mrpt::math::TPose2D &b) const
Operator "ominus" pose composition: "ret=this \ominus b".
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.
double distance(const TPoint2D &point) const
Distance from a given point.
void getAsSegmentList(std::vector< TSegment3D > &v) const
Gets as set of segments, instead of set of points.
bool isPolygon() const
Checks whether content is a polygon.
void getBestFittingPlane(TPlane &p) const
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not...
void getDirectorVector(double(&vector)[2]) const
Get line's director vector.
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.
static void getPlanes(const std::vector< TObject3D > &objs, std::vector< TPlane > &plns)
Static method to retrieve every plane included in a vector of objects.
TObject3D(const TPolygon3D &p)
Constructor from polygon.
double phi
Orientation (rads)
bool operator<(const TPoint2D &p) const
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>
Union type storing pointers to every allowed type.
void getCenter(TPoint3D &p) const
Get polygon's central point.
double omega
Angular velocity (rad/s)
bool contains(const TPoint3D &point) const
Check whether a point is contained into the plane.
double length() const
Segment length.
void getAsVector(std::vector< double > &v) const
Transformation into vector.
double & operator[](size_t i)
Coordinate access using operator[].
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.
bool operator!=(const TTwist2D &o) const
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
const double & operator[](size_t i) const
Coordinate access using operator[].
bool operator==(const TTwist2D &o) const
TPoint2D & operator/=(double d)
TPoint3Df operator*(const float s)
void getNormalVector(double(&vec)[3]) const
Get plane's normal vector.
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 .
static void getPoints(const std::vector< TObject3D > &objs, std::vector< TPoint3D > &pnts)
Static method to retrieve every point included in a vector of objects.