Go to the documentation of this file.
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 getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
static constexpr size_type max_size()
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];.
static void resize(const size_t n)
mrpt::math::TPose2D asTPose() const
void phi_incr(const double Aphi)
Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed)
mrpt::math::CVectorFixedDouble< 2 > m_coords
[x,y]
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
double phi() const
Get the phi angle of the 2D pose (in radians)
void setToNaN() override
Set all data fields to quiet NaN.
Base template for TPoint2D and TPoint2Df.
double x() const
Common members of all points & poses classes.
void composeFrom(const CPose2D &A, const CPose2D &B)
Makes .
CPose2D & operator+=(const CPose2D &b)
Make
double m_cosphi
Precomputed cos() & sin() of phi.
double & phi()
This is an overloaded member function, provided for convenience. It differs from the above function o...
double phi_cos() const
Get a (cached) value of cos(phi), recomputing it only once when phi changes.
A base class for representing a pose in 2D or 3D.
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 inverse()
Convert this pose into its inverse, saving the result in itself.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CPose2D operator-(const CPose2D &b) const
Compute
std::ostream & operator<<(std::ostream &o, const CPoint2D &p)
Dumps a point as a string (x,y)
CVectorFixed< double, N > CVectorFixedDouble
Specialization of CVectorFixed for double numbers.
CPose2D operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double distance2DFrobeniusTo(const CPose2D &p) const
Returns the 2D distance from this pose/point to a 2D pose using the Frobenius distance.
static CPose2D Identity()
Returns the identity transformation.
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...
const type_value & getPoseMean() const
std::ptrdiff_t difference_type
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...
double phi_sin() const
Get a (cached) value of sin(phi), recomputing it only once when phi changes.
CPose2D(TConstructorFlags_Poses)
Fast constructor that leaves all the data uninitialized - call with UNINITIALIZED_POSE as argument.
CPose2D getOppositeScalar() const
Return the opposite of the current pose instance by taking the negative of all its components individ...
type_value & getPoseMean()
void update_cached_cos_sin() const
static constexpr size_type size()
A compile-time fixed-size numeric matrix container.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
void AddComponents(const CPose2D &p)
Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operat...
std::string asString() const
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
bool operator!=(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The virtual base class which provides a unified interface for all persistent objects in MRPT.
static CPose2D FromString(const std::string &s)
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string.
double operator[](unsigned int i) const
CPose2D()
Default constructor (all coordinates to 0)
void inverseComposePoint(const double gx, const double gy, double &lx, double &ly) const
Computes the 2D point L such as .
static constexpr bool is_3D()
#define DEFINE_SCHEMA_SERIALIZABLE()
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
bool operator==(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
mrpt::math::CVectorFixedDouble< DIM > vector_t
Fixed-size vector of the correct size to hold all the coordinates of the point/pose.
MATRIX22 getRotationMatrix() const
CPose2D operator+(const CPose2D &D) const
The operator is the pose compounding operator.
static constexpr bool is_PDF()
static constexpr bool empty()
double value_type
The type of the elements.
A class used to store a 2D point.
A class used to store a 3D point.
void phi(double angle)
Set the phi angle of the 2D pose (in radians)
void asVector(vector_t &v) const
Returns a 1x3 vector with [x y phi].
void changeCoordinatesReference(const CPose2D &p)
makes: this = p (+) this
std::string std::string format(std::string_view fmt, ARGS &&... args)
void operator*=(const double s)
Scalar multiplication.
double m_phi
The orientation of the pose, in radians.
double & operator[](unsigned int i)
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020 | |