19 static_assert(std::is_trivially_copyable_v<TPose2D>);
34 m.
rows() == 1 && m.
cols() == 3,
"Wrong size of vector in ::fromString");
42 const double A_cosphi = cos(this->phi), A_sinphi = sin(this->phi);
44 const double new_x = this->x + b.
x * A_cosphi - b.
y * A_sinphi;
45 const double new_y = this->y + b.
x * A_sinphi + b.
y * A_cosphi;
54 const double B_cosphi = cos(b.
phi), B_sinphi = sin(b.
phi);
57 (this->x - b.
x) * B_cosphi + (this->y - b.
y) * B_sinphi;
59 -(this->x - b.
x) * B_sinphi + (this->y - b.
y) * B_cosphi;
66 const double ccos = ::cos(
phi), csin = ::sin(
phi);
67 return {
x + l.
x * ccos - l.
y * csin,
y + l.
x * csin + l.
y * ccos};
76 const double Ax = g.
x -
x, Ay = g.
y -
y, ccos = ::cos(
phi),
78 return {Ax * ccos + Ay * csin, -Ax * csin + Ay * ccos};
#define THROW_EXCEPTION(msg)
std::string std::string format(std::string_view fmt, ARGS &&... args)
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45...
This base provides a set of functions for maths stuff.
constexpr double DEG2RAD(const double x)
Degrees to radians.
mrpt::math::TPose2D operator+(const mrpt::math::TPose2D &b) const
Operator "oplus" pose composition: "ret=this \oplus b".
constexpr TPose2D()=default
Default fast constructor.
#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...
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.
size_type cols() const
Number of columns in the matrix.
constexpr double RAD2DEG(const double x)
Radians to degrees.
mrpt::math::TPoint2D composePoint(const TPoint2D l) const
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
std::string asString() const
mrpt::math::TPoint2D inverseComposePoint(const TPoint2D g) const
mrpt::math::TPose2D operator-(const mrpt::math::TPose2D &b) const
Operator "ominus" pose composition: "ret=this \ominus b".
double phi
Orientation (rads)