Go to the documentation of this file.
51 if (m_cossin_uptodate)
return;
53 ::sincos(m_phi,&m_sinphi,&m_cosphi);
55 m_cosphi=::cos(m_phi);
56 m_sinphi=::sin(m_phi);
58 m_cossin_uptodate=
true;
66 CPose2D(
const double x,
const double y,
const double phi);
84 inline const double &
phi()
const {
return m_phi; }
86 inline double &
phi() { m_cossin_uptodate=
false;
return m_phi; }
89 inline double phi_cos()
const { update_cached_cos_sin();
return m_cosphi; }
91 inline double phi_sin()
const { update_cached_cos_sin();
return m_sinphi; }
94 inline void phi(
double angle) { m_phi=angle; m_cossin_uptodate=
false; }
96 inline void phi_incr(
const double Aphi) { m_phi+=Aphi; m_cossin_uptodate=
false; }
113 getRotationMatrix(R);
131 void composePoint(
double lx,
double ly,
double &gx,
double &gy)
const;
139 void composePoint(
double lx,
double ly,
double lz,
double &gx,
double &gy,
double &gz)
const;
168 void AddComponents(
CPose2D &p);
184 void asString(std::string &s)
const;
191 void fromString(
const std::string &s);
197 case 0:
return m_coords[0];
198 case 1:
return m_coords[1];
201 throw std::runtime_error(
"CPose2D::operator[]: Index of bounds.");
208 case 0:
return m_coords[0];
209 case 1:
return m_coords[1];
212 throw std::runtime_error(
"CPose2D::operator[]: Index of bounds.");
220 double distance2DFrobeniusTo(
const CPose2D & p)
const;
223 enum { is_3D_val = 0 };
224 static inline bool is_3D() {
return is_3D_val!=0; }
225 enum { rotation_dimensions = 2 };
226 enum { is_PDF_val = 0 };
227 static inline bool is_PDF() {
return is_PDF_val!=0; }
238 typedef const
double& const_reference;
245 static inline bool empty() {
return false; }
247 static inline void resize(
const size_t n) {
if (n!=
static_size)
throw std::logic_error(
format(
"Try to change the size of CPose2D to %u.",
static_cast<unsigned>(n))); }
CPose2D BASE_IMPEXP operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
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...
static void resize(const size_t n)
double value_type
The type of the elements.
std::ptrdiff_t difference_type
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
const double & operator[](unsigned int i) const
double & phi()
This is an overloaded member function, provided for convenience. It differs from the above function o...
const double & phi() const
Get the phi angle of the 2D pose (in radians)
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.
CPose2D type_value
Used to emulate CPosePDF types, for example, in mrpt::graphs::CNetworkOfPoses.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Eigen::Matrix< dataType, 4, 4 > inverse(Eigen::Matrix< dataType, 4, 4 > &pose)
mrpt::math::TPoint2D BASE_IMPEXP operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose.
mrpt::math::CMatrixDouble22 getRotationMatrix() const
const type_value & getPoseMean() const
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.
type_value & getPoseMean()
std::vector< T1 > & operator+=(std::vector< T1 > &a, const std::vector< T2 > &b)
a+=b (element-wise sum)
#define DEFINE_SERIALIZABLE_POST(class_name)
std::string asString() const
A class used to store a 2D pose.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool operator!=(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
#define DEFINE_SERIALIZABLE_PRE(class_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
mrpt::aligned_containers< CPose2D >::deque_t StdDeque_CPose2D
Eigen aligment-compatible container.
std::deque< TYPE1, Eigen::aligned_allocator< TYPE1 > > deque_t
double m_sinphi
Precomputed cos() & sin() of phi.
A numeric matrix of compile-time fixed size.
bool operator==(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
static size_type max_size()
std::vector< T1 > & operator*=(std::vector< T1 > &a, const std::vector< T2 > &b)
a*=b (element-wise multiplication)
std::ostream & operator<<(std::ostream &o, const CPoint< DERIVEDCLASS > &p)
Dumps a point as a string [x,y] or [x,y,z]
mrpt::aligned_containers< CPose2D >::vector_t StdVector_CPose2D
Eigen aligment-compatible container.
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)
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
void update_cached_cos_sin() const
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
void changeCoordinatesReference(const CPose2D &p)
makes: this = p (+) this
double m_phi
The orientation of the pose, in radians.
mrpt::math::CArrayDouble< 2 > m_coords
[x,y]
double & operator[](unsigned int i)
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020 | | |