12 #include <mrpt/config.h>      21 #include <Eigen/Dense>    34 CPose2D::CPose2D(
const double x, 
const double y, 
const double _phi)
    35     : m_phi(_phi), m_cossin_uptodate(false)
    68             in >> x0 >> y0 >> phi0;
   101             m_coords[0] = 
static_cast<double>(in[
"x"]);
   102             m_coords[1] = 
static_cast<double>(in[
"y"]);
   103             m_phi = 
static_cast<double>(in[
"phi"]);
   137     A.update_cached_cos_sin();
   228     double lx, 
double ly, 
double lz, 
double& gx, 
double& gy, 
double& gz)
 const   237     const double gx, 
const double gy, 
double& lx, 
double& ly)
 const   340     : m_phi(o.phi), m_cossin_uptodate(false)
   386     return (p1.
x() == p2.
x()) && (p1.
y() == p2.
y()) && (p1.
phi() == p2.
phi());
   391     return (p1.
x() != p2.
x()) || (p1.
y() != p2.
y()) || (p1.
phi() != p2.
phi());
   396     const double ccos = pose.
phi_cos();
   397     const double ssin = pose.
phi_sin();
   399         pose.
x() + u.
x * ccos - u.
y * ssin, pose.
y() + u.
x * ssin + u.
y * ccos);
   429         4 * (1 - cos(p.
phi() - 
phi())));
   436         getHomogeneousMatrixVal<CMatrixDouble44>());
   452     for (
int i = 0; i < 3; i++)
   453         (*
this)[i] = std::numeric_limits<double>::quiet_NaN();
 void asVector(vector_t &v) const
Returns a 1x3 vector with [x y phi]. 
A compile-time fixed-size numeric matrix container. 
double phi_sin() const
Get a (cached) value of sin(phi), recomputing it only once when phi changes. 
TPoint2D_< double > TPoint2D
Lightweight 2D point. 
#define THROW_EXCEPTION(msg)
std::string std::string format(std::string_view fmt, ARGS &&... args)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files. 
mrpt::math::TPoint2D operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose. 
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive. 
std::ostream & operator<<(std::ostream &o, const CPoint2D &p)
Dumps a point as a string (x,y) 
MATRIX44 getInverseHomogeneousMatrixVal() const
void operator*=(const double s)
Scalar multiplication. 
void AddComponents(const CPose2D &p)
Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operat...
double m_cosphi
Precomputed cos() & sin() of phi. 
void composePoint(double lx, double ly, double &gx, double &gy) const
An alternative, slightly more efficient way of doing  with G and L being 2D points and P this 2D pose...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object. 
mrpt::math::TPose2D asTPose() const
mrpt::math::CVectorFixedDouble< 2 > m_coords
[x,y] 
Virtual base class for "schematic archives" (JSON, XML,...) 
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations. 
CPose2D operator-(const CPose2D &b) const
Compute . 
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string. 
This base provides a set of functions for maths stuff. 
double phi() const
Get the phi angle of the 2D pose (in radians) 
constexpr double DEG2RAD(const double x)
Degrees to radians. 
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive. 
double m_phi
The orientation of the pose, in radians. 
CPose2D operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
void setToNaN() override
Set all data fields to quiet NaN. 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
bool fromMatlabStringFormat(const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must st...
double x() const
Common members of all points & poses classes. 
void inverse()
Convert this pose into its inverse, saving the result in itself. 
CPose2D operator+(const CPose2D &D) const
The operator  is the pose compounding operator. 
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range. 
size_type rows() const
Number of rows in the matrix. 
A class used to store a 2D point. 
A class used to store a 3D point. 
size_type cols() const
Number of columns in the matrix. 
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods. 
MATRIX22 getRotationMatrix() const
std::string asString() const
bool operator!=(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
return_t square(const num_t x)
Inline function for the square of a number. 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
bool operator==(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
Virtual base class for "archives": classes abstracting I/O streams. 
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). 
mrpt::vision::TStereoCalibResults out
CPose2D & operator+=(const CPose2D &b)
Make . 
CPose2D getOppositeScalar() const
Return the opposite of the current pose instance by taking the negative of all its components individ...
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
constexpr double RAD2DEG(const double x)
Radians to degrees. 
void composeFrom(const CPose2D &A, const CPose2D &B)
Makes . 
double phi_cos() const
Get a (cached) value of cos(phi), recomputing it only once when phi changes. 
void inverseComposePoint(const double gx, const double gy, double &lx, double &ly) const
Computes the 2D point L such as . 
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
double distance2DFrobeniusTo(const CPose2D &p) const
Returns the 2D distance from this pose/point to a 2D pose using the Frobenius distance. 
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods. 
void inverseComposeFrom(const CPose2D &A, const CPose2D &B)
Makes  this method is slightly more efficient than "this= A - B;" since it avoids the temporary objec...
CMatrixFixed< double, 4, 4 > CMatrixDouble44
CPose2D()
Default constructor (all coordinates to 0) 
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];. 
void update_cached_cos_sin() const