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];
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
A numeric matrix of compile-time fixed size.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
2D polygon, inheriting from std::vector<TPoint2D>.
TPolygon2D(const std::vector< TPoint2D > &v)
Implicit constructor from a vector of 2D points.
TPolygon2D()
Default constructor
double distance(const TPoint2D &point) const
Distance to a point (always >=0)
void getAsSegmentList(std::vector< TSegment2D > &v) const
Gets as set of segments, instead of points.
void getCenter(TPoint2D &p) const
Polygon's central point.
static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D &poly)
Static method to create a regular polygon, given its size and radius.
void generate3DObject(TPolygon3D &p) const
Projects into 3D space, zeroing the z.
bool isConvex() const
Checks whether is convex.
void removeRedundantVertices()
Erase every redundant vertex from the polygon, saving space.
void removeRepeatedVertices()
Erase repeated vertices.
TPolygon2D(size_t N)
Constructor for a given number of vertices, intializing them as garbage.
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
void getPlotData(std::vector< double > &x, std::vector< double > &y) const
Gets plot data, ready to use on a 2D plot.
void getBoundingBox(TPoint2D &min_coords, TPoint2D &max_coords) const
Get polygon bounding box.
3D polygon, inheriting from std::vector<TPoint3D>
TPolygon3D()
Default constructor.
void getBestFittingPlane(TPlane &p) const
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.
void getAsSegmentList(std::vector< TSegment3D > &v) const
Gets as set of segments, instead of set of points.
bool isSkew() const
Check whether the polygon is skew.
bool contains(const TPoint3D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly)
Static method to create a regular polygon, given its size and radius.
void generate2DObject(TPolygon2D &p) const
Projects into a 2D space, discarding the z.
void removeRedundantVertices()
Erase every redundant vertex, thus saving space.
TPolygon3D(const std::vector< TPoint3D > &v)
Implicit constructor from a 3D points vector.
double distance(const TPoint3D &point) const
Distance to point (always >=0)
void removeRepeatedVertices()
Remove polygon's repeated vertices.
TPolygon3D(size_t N)
Constructor for a given size.
bool getPlane(TPlane &p) const
Gets a plane which contains the polygon.
void getCenter(TPoint3D &p) const
Get polygon's central point.
A class used to store a 2D point.
A class used to store a 3D point.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
The base template class for 2D & 3D points and poses.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLsizei GLsizei GLuint * obj
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLsizei const GLchar ** string
GLdouble GLdouble GLdouble GLdouble q
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
const unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
bool operator!=(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
const unsigned char GEOMETRIC_TYPE_LINE
Object type identifier for TLine2D or TLine3D.
TPoint3D operator-(const TPoint3D &p1)
Unary minus operator for 3D points.
const unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
std::ostream & operator<<(std::ostream &o, const TPoint2D &p)
const unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
const unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
const unsigned char GEOMETRIC_TYPE_PLANE
Object type identifier for TPlane.
#define THROW_EXCEPTION(msg)
This base provides a set of functions for maths stuff.
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.
mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrix::Ptr &pObj)
T square(const T x)
Inline function for the square of a number.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
2D line without bounds, represented by its equation .
TLine2D()
Fast default constructor.
double evaluatePoint(const TPoint2D &point) const
Evaluate point in the line's equation.
void generate3DObject(TLine3D &l) const
Project into 3D space, setting the z to 0.
void getNormalVector(double(&vector)[2]) const
Get line's normal vector.
void getUnitaryDirectorVector(double(&vector)[2])
Unitarize line and then get director vector.
double signedDistance(const TPoint2D &point) const
Distance with sign from a given point (sign indicates side).
double coefs[3]
Line coefficients, stored as an array: .
void unitarize()
Unitarize line's normal vector.
double distance(const TPoint2D &point) const
Distance from a given point.
void getDirectorVector(double(&vector)[2]) const
Get line's director vector.
void getAsPose2D(mrpt::poses::CPose2D &outPose) const
Get a pose2D whose X axis corresponds to the line.
bool contains(const TPoint2D &point) const
Check whether a point is inside the line.
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.
TLine2D(double A, double B, double C)
Constructor from line's coefficients.
void getUnitaryNormalVector(double(&vector)[2])
Get line's normal vector after unitarizing line.
3D line, represented by a base point and a director vector.
TLine3D()
Fast default constructor.
void getDirectorVector(double(&vector)[3]) const
Get director vector.
double distance(const TPoint3D &point) const
Distance between the line and a point.
double director[3]
Director vector.
void unitarize()
Unitarize director vector.
bool contains(const TPoint3D &point) const
Check whether a point is inside the line.
void generate2DObject(TLine2D &l) const
Project into 2D space, discarding the Z coordinate.
void getUnitaryDirectorVector(double(&vector)[3])
Unitarize and then get director vector.
TPoint3D pBase
Base point.
Union type storing pointers to every allowed type.
Standard type for storing any lightweight 2D type.
void generate3DObject(TObject3D &obj) const
Project into 3D space.
void operator=(const TPoint2D &p)
Assign a point to this object.
bool isPoint() const
Checks whether content is a 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.
bool isSegment() const
Checks whether content is a segment.
TObject2D(const TPoint2D &p)
Implicit constructor from point.
bool isPolygon() const
Checks whether content is a polygon.
static void getPoints(const std::vector< TObject2D > &objs, std::vector< TPoint2D > &pnts)
Static method to retrieve all the points in a vector of TObject2D.
bool getLine(TLine2D &r) const
Gets the content as a line, returning false if the type is inadequate.
~TObject2D()
Object destruction.
unsigned char type
Object type identifier.
TObject2D(const TLine2D &r)
Implicit constructor from line.
unsigned char getType() const
Gets content type.
TObject2D(const TObject2D &obj)
Constructor from another TObject2D.
void operator=(const TPolygon2D &p)
Assign a polygon to this object.
bool getSegment(TSegment2D &s) const
Gets the content as a segment, returning false if the type is inadequate.
bool getPolygon(TPolygon2D &p) const
Gets the content as a polygon, returning false if the type is inadequate.
void destroy()
Destroys the object, releasing the pointer to the content (if any).
void operator=(const TLine2D &l)
Assign a line to this object.
bool getPoint(TPoint2D &p) const
Gets the content as a point, returning false if the type is inadequate.
TObject2D(const TPolygon2D &p)
Implicit constructor from polygon.
static void getSegments(const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms)
Static method to retrieve all the segments in a vector of TObject2D.
TObject2D(const TSegment2D &s)
Implicit constructor from segment.
bool isLine() const
Checks whether content is a line.
void operator=(const TSegment2D &s)
Assign a segment to this object.
TObject2D()
Implicit constructor from polygon.
struct mrpt::math::TObject2D::tobject2d_data_t data
TObject2D & operator=(const TObject2D &obj)
Assign another TObject2D.
static void getPolygons(const std::vector< TObject2D > &objs, std::vector< TPolygon2D > &polys)
Static method to retrieve all the polygons in a vector of TObject2D.
Union containing pointer to actual data.
Standard object for storing any 3D lightweight object.
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 operator=(const TPolygon3D &p)
Assigns a polygon to this object.
void operator=(const TPoint3D &p)
Assigns a point to this object.
bool isPolygon() const
Checks whether content is a polygon.
TObject3D & operator=(const TObject3D &obj)
Assigns another object, creating a new pointer if needed.
void operator=(const TSegment3D &s)
Assigns a segment to this object.
bool getPlane(TPlane &p) const
Gets the content as a plane, returning false if the type is not adequate.
TObject3D(const TLine3D &r)
Constructor from line.
void destroy()
Destroys the object and releases the pointer, if any.
void operator=(const TPlane &p)
Assigns a plane to this object.
unsigned char getType() const
Gets object type.
TObject3D(const TPlane &p)
Constructor from plane.
bool isLine() const
Checks whether content is a line.
bool isSegment() const
Checks whether content is a segment.
TObject3D(const TPoint3D &p)
Constructor from point.
static void getPoints(const std::vector< TObject3D > &objs, std::vector< TPoint3D > &pnts)
Static method to retrieve every point included in a vector of objects.
bool getSegment(TSegment3D &s) const
Gets the content as a segment, returning false if the type is not adequate.
struct mrpt::math::TObject3D::tobject3d_data_t data
bool getLine(TLine3D &r) const
Gets the content as a line, returning false if the type is not adequate.
void operator=(const TLine3D &l)
Assigns a line to this object.
TObject3D(const TSegment3D &s)
Constructor from segment.
static void getLines(const std::vector< TObject3D > &objs, std::vector< TLine3D > &lins)
Static method to retrieve every line included in a vector of objects.
static void getPolygons(const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys)
Static method to retrieve every polygon 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.
unsigned char type
Object type identifier.
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.
bool isPlane() const
Checks whether content is a plane.
TObject3D()
Empty constructor.
bool isPoint() const
Checks whether content is a point.
TObject3D(const TObject3D &obj)
Constructs from another object.
void generate2DObject(TObject2D &obj) const
Projects into 2D space.
bool getPolygon(TPolygon3D &p) const
Gets the content as a polygon, returning false if the type is not adequate.
3D Plane, represented by its equation
TPlane()
Fast default constructor.
void getAsPose3D(mrpt::poses::CPose3D &outPose) const
Gets a pose whose XY plane corresponds to this plane.
double distance(const TPoint3D &point) const
Distance to 3D point.
double evaluatePoint(const TPoint3D &point) const
Evaluate a point in the plane's equation.
bool contains(const TSegment3D &segment) const
Check whether a segment is fully contained into the plane.
void getNormalVector(double(&vec)[3]) const
Get plane's normal vector.
void getUnitaryNormalVector(double(&vec)[3])
Unitarize, then get normal vector.
void getAsPose3D(mrpt::poses::CPose3D &outPose)
Gets a pose whose XY plane corresponds to this plane.
bool contains(const TPoint3D &point) const
Check whether a point is contained into the plane.
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.
double coefs[4]
Plane coefficients, stored as an array: .
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
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.
TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
void unitarize()
Unitarize normal vector.
TPoint2D & operator*=(double d)
TPoint2D operator*(double d) const
TPoint2D & operator-=(const TPoint2D &p)
TPoint2D(const mrpt::utils::TPixelCoordf &p)
Implicit transformation constructor from TPixelCoordf.
TPoint2D & operator/=(double d)
TPoint2D(const mrpt::poses::CPoseOrPoint< DERIVEDCLASS > &p)
Constructor from CPoseOrPoint, perhaps losing 3D information.
TPoint2D(double xx, double yy)
Constructor from coordinates.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" )
bool operator<(const TPoint2D &p) const
TPoint2D 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]" )
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
TPoint2D operator-(const TPoint2D &p) const
double norm() const
Point norm.
double & operator[](size_t i)
Coordinate access using operator[].
TPoint2D & operator+=(const TPoint2D &p)
TPoint2D operator/(double d) const
TPoint2D()
Default fast constructor.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0....
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
std::string asString() const
TPoint3D(double xx, double yy, double zz)
Constructor from coordinates.
double x
X,Y,Z coordinates.
TPoint3D operator+(const TPoint3D &p) const
Points addition.
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[].
TPoint3D(const TPoint3Df &p)
Explicit constructor from coordinates.
TPoint3D operator/(double d) const
double norm() const
Point norm.
TPoint3D operator*(double d) const
TPoint3D & operator+=(const TPoint3D &p)
Translation.
TPoint3D & operator*=(const double f)
Point scale.
TPoint3D()
Default fast constructor.
void getAsVector(VECTORLIKE &v) const
Transformation into vector.
double sqrDistanceTo(const TPoint3D &p) const
Point-to-point distance, squared.
double & operator[](size_t i)
Coordinate access using operator[].
TPoint3D operator-(const TPoint3D &p) const
Points substraction.
bool operator<(const TPoint3D &p) const
Lightweight 3D point (float version).
TPoint3Df & operator+=(const TPoint3Df &p)
TPoint3Df operator*(const float s)
float & operator[](size_t i)
Coordinate access using operator[].
const float & operator[](size_t i) const
Coordinate access using operator[].
TPoint3Df(const float xx, const float yy, const float zz)
XYZ point (double) + Intensity(u8)
TPointXYZIu8(double x, double y, double z, uint8_t intensity_val)
XYZ point (double) + RGB(u8)
TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
XYZ point (float) + Intensity(u8)
TPointXYZfIu8(float x, float y, float z, uint8_t intensity_val)
XYZ point (float) + RGB(u8)
TPointXYZfRGBu8(float x, float y, float z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
void inverseComposePoint(const TPoint2D g, TPoint2D &l) const
double phi
Orientation (rads)
mrpt::math::TPose2D operator+(const mrpt::math::TPose2D &b) const
Operator "oplus" pose composition: "ret=this \oplus b".
std::string asString() const
TPose2D(double xx, double yy, double pphi)
Constructor from coordinates.
double & operator[](size_t i)
Coordinate access using operator[].
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45....
TPose2D()
Default fast constructor.
void composePoint(const TPoint2D l, TPoint2D &g) const
double norm() const
Returns the norm of the (x,y) vector (phi is not used)
mrpt::math::TPose2D operator-(const mrpt::math::TPose2D &b) const
Operator "ominus" pose composition: "ret=this \ominus b".
const double & operator[](size_t i) const
Coordinate access using operator[].
void getAsVector(std::vector< double > &v) const
Transformation into vector.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
const double & operator[](size_t i) const
Coordinate access using operator[].
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
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)
TPose3D(double _x, double _y, double _z, double _yaw, double _pitch, double _roll)
Constructor from coordinates.
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
double roll
Roll coordinate (rotation angle over X coordinate).
std::string asString() const
double norm() const
Pose's spatial coordinates norm.
double & operator[](size_t i)
Coordinate access using operator[].
TPose3D()
Default fast constructor.
double pitch
Pitch coordinate (rotation angle over Y axis).
double yaw
Yaw coordinate (rotation angle over Z axis).
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
std::string asString() const
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
const double & operator[](size_t i) const
Coordinate access using operator[].
double x
Translation in x,y,z.
TPose3DQuat(double _x, double _y, double _z, double _qr, double _qx, double _qy, double _qz)
Constructor from coordinates.
double & operator[](size_t i)
Coordinate access using operator[].
void asString(std::string &s) const
Returns a human-readable textual representation of the object as "[x y z qr qx qy qz]".
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
double norm() const
Pose's spatial coordinates norm.
double qr
Unit quaternion part, qr,qx,qy,qz.
TPose3DQuat()
Default fast constructor.
2D segment, consisting of two points.
bool contains(const TPoint2D &point) const
Check whether a point is inside a segment.
TPoint2D point2
Destiny point.
const TPoint2D & operator[](size_t i) const
Access to points using operator[0-1].
TSegment2D(const TPoint2D &p1, const TPoint2D &p2)
Constructor from both points.
double signedDistance(const TPoint2D &point) const
Distance with sign to point (sign indicates which side the point is).
bool operator<(const TSegment2D &s) const
TSegment2D()
Fast default constructor.
TPoint2D & operator[](size_t i)
Access to points using operator[0-1].
TPoint2D point1
Origin point.
void getCenter(TPoint2D &p) const
Segment's central point.
void generate3DObject(TSegment3D &s) const
Project into 3D space, setting the z to 0.
double length() const
Segment length.
double distance(const TPoint2D &point) const
Distance to point.
3D segment, consisting of two points.
double distance(const TPoint3D &point) const
Distance to point.
TPoint3D point1
Origin point.
void getCenter(TPoint3D &p) const
Segment's central point.
double length() const
Segment length.
TPoint3D point2
Destiny point.
const TPoint3D & operator[](size_t i) const
Access to points using operator[0-1].
TPoint3D & operator[](size_t i)
Access to points using operator[0-1].
bool operator<(const TSegment3D &s) const
TSegment3D()
Fast default constructor.
bool contains(const TPoint3D &point) const
Check whether a point is inside the segment.
TSegment3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from both points.
TSegment3D(const TSegment2D &s)
Constructor from 2D object.
void generate2DObject(TSegment2D &s) const
Projection into 2D space, discarding the z.
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
const double & operator[](size_t i) const
Coordinate access using operator[].
std::string asString() const
void rotate(const double ang)
Transform the (vx,vy) components for a counterclockwise rotation of ang radians.
bool operator!=(const TTwist2D &o) const
void getAsVector(std::vector< double > &v) const
Transformation into vector.
mrpt::math::TPose2D operator*(const double dt) const
Returns the pose increment of multiplying each twist component times "dt" seconds.
TTwist2D(double vx_, double vy_, double omega_)
Constructor from components.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45....
bool operator==(const TTwist2D &o) const
double vx
Velocity components: X,Y (m/s)
double & operator[](size_t i)
Coordinate access using operator[].
TTwist2D()
Default fast constructor.
double omega
Angular velocity (rad/s)
3D twist: 3D velocity vector (vx,vy,vz) + angular velocity (wx,wy,wz)
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[vx vy vz wx wy wz]" )
std::string asString() const
void getAsVector(std::vector< double > &v) const
Transformation into vector.
TTwist3D(double vx_, double vy_, double vz_, double wx_, double wy_, double wz_)
Constructor from components.
double & operator[](size_t i)
Coordinate access using operator[].
bool operator!=(const TTwist3D &o) const
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...
const double & operator[](size_t i) const
Coordinate access using operator[].
TTwist3D()
Default fast constructor.
double vx
Velocity components: X,Y (m/s)
bool operator==(const TTwist3D &o) const
double wx
Angular velocity (rad/s)
A pair (x,y) of pixel coordinates (subpixel resolution).