63 CPose2D(
const double x,
const double y,
const double phi);
110 inline void phi(
double angle)
138 template <
class MATRIX22>
164 void composePoint(
double lx,
double ly,
double& gx,
double& gy)
const;
180 double lx,
double ly,
double lz,
double& gx,
double& gy,
186 const double gx,
const double gy,
double& lx,
double& ly)
const;
247 void asString(std::string& s)
const;
283 throw std::runtime_error(
284 "CPose2D::operator[]: Index of bounds.");
298 throw std::runtime_error(
299 "CPose2D::operator[]: Index of bounds.");
349 static constexpr
bool empty() {
return false; }
351 static inline void resize(
const size_t n)
354 throw std::logic_error(
format(
355 "Try to change the size of CPose2D to %u.",
356 static_cast<unsigned>(n)));
363 std::ostream&
operator<<(std::ostream& o,
const CPose2D& p);
373 bool operator==(
const CPose2D& p1,
const CPose2D& p2);
374 bool operator!=(
const CPose2D& p1,
const CPose2D& p2);
void asVector(vector_t &v) const
Returns a 1x3 vector with [x y phi].
A compile-time fixed-size numeric matrix container.
void changeCoordinatesReference(const CPose2D &p)
makes: this = p (+) this
double phi_sin() const
Get a (cached) value of sin(phi), recomputing it only once when phi changes.
const type_value & getPoseMean() const
std::string std::string format(std::string_view fmt, ARGS &&... args)
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.
std::ostream & operator<<(std::ostream &o, const CPoint2D &p)
Dumps a point as a string (x,y)
type_value & getPoseMean()
mrpt::math::CVectorFixedDouble< DIM > vector_t
Fixed-size vector of the correct size to hold all the coordinates of the point/pose.
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...
static CPose2D Identity()
Returns the identity transformation.
double m_cosphi
Precomputed cos() & sin() of phi.
#define DEFINE_SCHEMA_SERIALIZABLE()
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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...
CPose2D(TConstructorFlags_Poses)
Fast constructor that leaves all the data uninitialized - call with UNINITIALIZED_POSE as argument...
mrpt::math::TPose2D asTPose() const
mrpt::math::CVectorFixedDouble< 2 > m_coords
[x,y]
CPose2D operator-(const CPose2D &b) const
Compute .
double operator[](unsigned int i) const
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string.
double value_type
The type of the elements.
static constexpr size_type size()
double phi() const
Get the phi angle of the 2D pose (in radians)
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.
A base class for representing a pose in 2D or 3D.
double x() const
Common members of all points & poses classes.
void inverse()
Convert this pose into its inverse, saving the result in itself.
static constexpr size_type max_size()
static constexpr bool is_PDF()
CPose2D operator+(const CPose2D &D) const
The operator is the pose compounding operator.
A class used to store a 2D point.
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Base template for TPoint2D and TPoint2Df.
MATRIX22 getRotationMatrix() const
std::string asString() const
bool operator!=(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
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)
double & operator[](unsigned int i)
static constexpr bool is_3D()
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).
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...
static void resize(const size_t n)
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...
CVectorFixed< double, N > CVectorFixedDouble
Specialization of CVectorFixed for double numbers.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void phi(double angle)
Set the phi angle of the 2D pose (in radians)
double distance2DFrobeniusTo(const CPose2D &p) const
Returns the 2D distance from this pose/point to a 2D pose using the Frobenius distance.
std::ptrdiff_t difference_type
static CPose2D FromString(const std::string &s)
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...
CPose2D()
Default constructor (all coordinates to 0)
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];.
static constexpr bool empty()
void update_cached_cos_sin() const
void phi_incr(const double Aphi)
Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed) ...