21 #include <type_traits>
68 constexpr
TPoint2D(
double xx,
double yy) :
x(xx),
y(yy) {}
83 throw std::out_of_range(
"index out of range");
96 throw std::out_of_range(
"index out of range");
142 return {
x +
p.
x,
y +
p.y};
147 return {
x -
p.
x,
y -
p.y};
177 static size_t size() {
return 2; }
234 throw std::out_of_range(
"index out of range");
249 throw std::out_of_range(
"index out of range");
281 const double ccos = ::cos(
phi), csin = ::sin(
phi);
282 return {
x + l.
x * ccos - l.
y * csin,
y + l.
x * csin + l.
y * ccos};
292 const double Ax =
g.
x -
x, Ay =
g.y -
y, ccos = ::cos(
phi),
294 return { Ax * ccos + Ay * csin, -Ax * csin + Ay * ccos };
309 constexpr
static size_t size() {
return 3; }
326 constexpr
TPoint3Df(
const float xx,
const float yy,
const float zz)
327 :
x(xx),
y(yy),
z(zz)
353 throw std::out_of_range(
"index out of range");
369 throw std::out_of_range(
"index out of range");
388 constexpr
TPoint3D(
double xx,
double yy,
double zz) :
x(xx),
y(yy),
z(zz) {}
419 throw std::out_of_range(
"index out of range");
434 throw std::out_of_range(
"index out of range");
471 template <
class VECTORLIKE>
504 return {
x +
p.
x,
y +
p.y,
z +
p.z};
511 return {
x -
p.
x,
y -
p.y,
z -
p.z};
516 return {
x * d,
y * d,
z * d};
521 return {
x / d,
y / d,
z / d};
547 static constexpr
size_t size() {
return 3; }
570 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
593 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
637 double _x,
double _y,
double _z,
double _yaw,
double _pitch,
664 throw std::out_of_range(
"index out of range");
685 throw std::out_of_range(
"index out of range");
752 static size_t size() {
return 6; }
759 TPose3D
operator-(
const TPose3D&
b,
const TPose3D&
a);
778 double _x,
double _y,
double _z,
double _qr,
double _qx,
double _qy,
780 :
x(_x),
y(_y),
z(_z),
qr(_qr),
qx(_qx),
qy(_qy),
qz(_qz)
805 throw std::out_of_range(
"index out of range");
828 throw std::out_of_range(
"index out of range");
837 for (
size_t i = 0; i < 7; i++)
v[i] = (*
this)[i];
860 static size_t size() {
return 7; }
864 std::ostream&
operator<<(std::ostream& o,
const TPoint2D&
p);
865 std::ostream&
operator<<(std::ostream& o,
const TPoint3D&
p);
866 std::ostream&
operator<<(std::ostream& o,
const TPose2D&
p);
867 std::ostream&
operator<<(std::ostream& o,
const TPose3D&
p);
868 std::ostream&
operator<<(std::ostream& o,
const TPose3DQuat&
p);
875 return {-p1.
x, -p1.
y, -p1.
z};
882 return (p1.
x == p2.
x) && (p1.
y == p2.
y);
889 return (p1.
x != p2.
x) || (p1.
y != p2.
y);
896 return (p1.
x == p2.
x) && (p1.
y == p2.
y) && (p1.
z == p2.
z);
903 return (p1.
x != p2.
x) || (p1.
y != p2.
y) || (p1.
z != p2.
z);
910 return (p1.
x == p2.
x) && (p1.
y == p2.
y) &&
919 return (p1.
x != p2.
x) || (p1.
y != p2.
y) ||
928 return (p1.
x == p2.
x) && (p1.
y == p2.
y) && (p1.
z == p2.
z) &&
940 return (p1.
x != p2.
x) || (p1.
y != p2.
y) || (p1.
z != p2.
z) ||
995 throw std::out_of_range(
"index out of range");
1008 throw std::out_of_range(
"index out of range");
1081 throw std::out_of_range(
"index out of range");
1094 throw std::out_of_range(
"index out of range");
1272 for (
size_t i = 0; i < 3; i++) vector[i] =
director[i];
1383 constexpr
TPlane(
double A,
double B,
double C,
double D) :
1392 for (
size_t i = 0; i < 4; i++)
coefs[i] = vec[i];
1426 void getPlotData(std::vector<double>&
x, std::vector<double>&
y)
const;
1443 size_t numEdges,
double radius,
TPolygon2D& poly);
1450 size_t numEdges,
double radius,
TPolygon2D& poly,
1498 size_t numEdges,
double radius,
TPolygon3D& poly);
1505 size_t numEdges,
double radius,
TPolygon3D& poly,
1678 p = *(
data.polygon);
1689 if (
this == &
obj)
return *
this;
1697 data.segment =
obj.data.segment;
1759 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts);
1764 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms);
1769 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins);
1774 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys);
1780 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts,
1781 std::vector<TObject2D>& remainder);
1787 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms,
1788 std::vector<TObject2D>& remainder);
1794 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins,
1795 std::vector<TObject2D>& remainder);
1801 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys,
1802 std::vector<TObject2D>& remainder);
1949 p = *(
data.polygon);
1974 if (
this == &
obj)
return *
this;
1982 data.segment =
obj.data.segment;
2067 throw std::logic_error(
"Too many dimensions");
2084 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts);
2089 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms);
2094 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins);
2099 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns);
2104 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys);
2110 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts,
2111 std::vector<TObject3D>& remainder);
2117 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms,
2118 std::vector<TObject3D>& remainder);
2124 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins,
2125 std::vector<TObject3D>& remainder);
2131 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns,
2132 std::vector<TObject3D>& remainder);
2138 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys,
2139 std::vector<TObject3D>& remainder);
2157 constexpr
TTwist2D(
double vx_,
double vy_,
double omega_)
2175 throw std::out_of_range(
"index out of range");
2190 throw std::out_of_range(
"index out of range");
2203 void rotate(
const double ang);
2246 double vx_,
double vy_,
double vz_,
double wx_,
double wy_,
double wz_)
2270 throw std::out_of_range(
"index out of range");
2291 throw std::out_of_range(
"index out of range");
2298 for (
int i = 0; i < 6; i++)
v[i] = (*
this)[i];
2329 template <
class PoseOrPoint,
typename = std::enable_if_t<std::is_base_of<
2334 for (
int i = 0; i < o.static_size; i++)
in >> o[i];
2337 template <
class PoseOrPoint,
typename = std::enable_if_t<std::is_base_of<
2342 for (
int i = 0; i < o.static_size; i++) out << o[i];
#define MRPT_DECLARE_TTYPENAME_NO_NAMESPACE(_TYPE, __NS)
Declares a typename to be "type" (without the NS prefix)
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.
Virtual base class for "archives": classes abstracting I/O streams.
#define THROW_EXCEPTION(msg)
GLsizei GLsizei GLuint * obj
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLubyte GLubyte GLubyte a
GLsizei const GLfloat * value
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.
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
static constexpr unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
static constexpr unsigned char GEOMETRIC_TYPE_LINE
Object type identifier for TLine2D or TLine3D.
static constexpr unsigned char GEOMETRIC_TYPE_PLANE
Object type identifier for TPlane.
std::ostream & operator<<(std::ostream &o, const TPoint2D &p)
static constexpr unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
static constexpr unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
TPose3D operator-(const TPose3D &p)
Unary $\ominus$ operator: computes inverse SE(3) element.
constexpr bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
static constexpr unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
constexpr bool operator!=(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This base provides a set of functions for maths stuff.
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, CMatrix::Ptr &pObj)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T square(const T x)
Inline function for the square of a number.
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.
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 getAsPose2D(TPose2D &outPose) const
void getUnitaryDirectorVector(double(&vector)[2])
Unitarize line and then get director vector.
constexpr TLine2D(double A, double B, double C)
Constructor from line's coefficients.
void getAsPose2DForcingOrigin(const TPoint2D &origin, TPose2D &outPose) const
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.
bool contains(const TPoint2D &point) const
Check whether a point is inside the line.
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.
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.
bool contains(const TPoint3D &point) const
Check whether a point is contained into the plane.
void getAsPose3D(mrpt::math::TPose3D &outPose)
double coefs[4]
Plane coefficients, stored as an array: .
TPlane(const double(&vec)[4])
Constructor from an array of coefficients.
constexpr TPlane(double A, double B, double C, double D)
Constructor from plane coefficients.
void getAsPose3DForcingOrigin(const TPoint3D &newOrigin, TPose3D &pose)
void unitarize()
Unitarize normal vector.
constexpr TPoint2D operator/(double d) const
TPoint2D & operator*=(double d)
TPoint2D & operator-=(const TPoint2D &p)
TPoint2D & operator/=(double d)
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" )
constexpr TPoint2D operator+(const TPoint2D &p) const
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]" )
void getAsVector(std::vector< double > &v) const
Transformation into vector.
constexpr TPoint2D operator*(double d) const
std::string asString() const
constexpr TPoint2D(double xx, double yy)
Constructor from coordinates.
double norm() const
Point norm.
double & operator[](size_t i)
Coordinate access using operator[].
constexpr TPoint2D operator-(const TPoint2D &p) const
TPoint2D & operator+=(const TPoint2D &p)
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
TPoint2D()
Default fast constructor.
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
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.
constexpr TPoint3D(double xx, double yy, double zz)
Constructor from coordinates.
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
std::string asString() const
constexpr TPoint3D operator/(double d) const
double x
X,Y,Z coordinates.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
TPoint3D(const TPoint3Df &p)
Explicit constructor from coordinates.
constexpr TPoint3D operator+(const TPoint3D &p) const
Points addition.
static constexpr size_t size()
double norm() const
Point norm.
constexpr TPoint3D operator*(double d) const
TPoint3D & operator+=(const TPoint3D &p)
Translation.
constexpr TPoint3D operator-(const TPoint3D &p) const
Points substraction.
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[].
bool operator<(const TPoint3D &p) const
Lightweight 3D point (float version).
TPoint3Df & operator+=(const TPoint3Df &p)
constexpr TPoint3Df(const float xx, const float yy, const float zz)
TPoint3Df operator*(const float s)
float & operator[](size_t i)
Coordinate access using operator[].
constexpr const float & operator[](size_t i) const
Coordinate access using operator[].
XYZ point (double) + Intensity(u8)
constexpr TPointXYZIu8(double x, double y, double z, uint8_t intensity_val)
XYZ point (double) + RGB(u8)
constexpr TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
XYZ point (float) + Intensity(u8)
constexpr TPointXYZfIu8(float x, float y, float z, uint8_t intensity_val)
XYZ point (float) + RGB(u8)
constexpr TPointXYZfRGBu8(float x, float y, float z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
mrpt::math::TPoint2D operator+(const mrpt::math::TPoint2D &b) const
mrpt::math::TPoint2D composePoint(const 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".
constexpr static size_t size()
mrpt::math::TPoint2D inverseComposePoint(const TPoint2D g) const
std::string asString() const
TPose2D(double xx, double yy, double pphi)
Constructor from coordinates.
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
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.
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".
void getAsVector(std::vector< double > &v) const
Transformation into vector.
void normalizePhi()
Forces "phi" to be in the range [-pi,pi].
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
constexpr TPose3D(double _x, double _y, double _z, double _yaw, double _pitch, double _roll)
Constructor from coordinates.
void composePose(const TPose3D other, TPose3D &result) const
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
void getRotationMatrix(mrpt::math::CMatrixDouble33 &R) const
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)
void inverseComposePoint(const TPoint3D g, TPoint3D &l) const
void getInverseHomogeneousMatrix(mrpt::math::CMatrixDouble44 &HG) const
void fromHomogeneousMatrix(const mrpt::math::CMatrixDouble44 &HG)
void getAsVector(std::vector< double > &v) const
Gets the pose as a vector of doubles.
void composePoint(const TPoint3D l, TPoint3D &g) const
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).
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &HG) const
static void SO3_to_yaw_pitch_roll(const mrpt::math::CMatrixDouble33 &R, double &yaw, double &pitch, double &roll)
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.
double x
Translation in x,y,z.
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]".
constexpr TPose3DQuat(double _x, double _y, double _z, double _qr, double _qx, double _qy, double _qz)
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 -0....
double norm() const
Pose's spatial coordinates norm.
double qr
Unit quaternion part, qr,qx,qy,qz.
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
TPose3DQuat()
Default fast constructor.
Base type of all TPoseXX and TPointXX classes in mrpt::math.
2D segment, consisting of two points.
bool contains(const TPoint2D &point) const
Check whether a point is inside a segment.
TPoint2D point2
Destiny point.
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
constexpr const TPoint2D & operator[](size_t i) const
Access to points using operator[0-1].
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)
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.
constexpr 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 -45....
bool operator==(const TTwist2D &o) const
double vx
Velocity components: X,Y (m/s)
constexpr TTwist2D(double vx_, double vy_, double omega_)
Constructor from components.
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]" )
void rotate(const mrpt::math::TPose3D &rot)
Transform all 6 components for a change of reference frame from "A" to another frame "B" whose rotati...
std::string asString() const
void getAsVector(std::vector< double > &v) const
Transformation into vector.
double & operator[](size_t i)
Coordinate access using operator[].
bool operator!=(const TTwist3D &o) const
constexpr 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
constexpr TTwist3D(double vx_, double vy_, double vz_, double wx_, double wy_, double wz_)
Constructor from components.
double wx
Angular velocity (rad/s)