10 #define CPOSEORPOINT_H 106 template <
class DERIVEDCLASS>
113 inline double x() const {
return static_cast<const DERIVEDCLASS*
>(
this)->m_coords[0]; }
114 inline double y() const {
return static_cast<const DERIVEDCLASS*
>(
this)->m_coords[1]; }
116 inline double &
x() {
return static_cast<DERIVEDCLASS*
>(
this)->m_coords[0]; }
117 inline double &
y() {
return static_cast<DERIVEDCLASS*
>(
this)->m_coords[1]; }
119 inline void x(
const double v) {
static_cast<DERIVEDCLASS*
>(
this)->m_coords[0]=
v; }
120 inline void y(
const double v) {
static_cast<DERIVEDCLASS*
>(
this)->m_coords[1]=
v; }
122 inline void x_incr(
const double v) {
static_cast<DERIVEDCLASS*
>(
this)->m_coords[0]+=
v; }
123 inline void y_incr(
const double v) {
static_cast<DERIVEDCLASS*
>(
this)->m_coords[1]+=
v; }
134 if (
b.is3DPoseOrPoint())
137 return square(
x()-
b.x()) +
square(
y()-
b.y()) +
square(static_cast<const DERIVEDCLASS*>(
this)->m_coords[2]-
static_cast<const OTHERCLASS*
>(&
b)->m_coords[2]);
149 template <
class OTHERCLASS>
184 static_cast<const DERIVEDCLASS*
>(
this)->getAsVector(
v);
194 static_cast<const DERIVEDCLASS*
>(
this)->getHomogeneousMatrix(m);
203 static_cast<const DERIVEDCLASS*
>(
this)->getHomogeneousMatrix(out_HM);
double x() const
Common members of all points & poses classes.
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
mrpt::math::CVectorDouble getAsVectorVal() const
Return the pose or point as a 1xN vector with all the components (see derived classes for each implem...
void y_incr(const double v)
static bool is3DPoseOrPoint()
Return true for poses or points with a Z component, false otherwise.
double distanceTo(const mrpt::math::TPoint3D &b) const
Returns the euclidean distance to a 3D point:
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
mrpt::math::CMatrixDouble44 getHomogeneousMatrixVal() const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
T square(const T x)
Inline function for the square of a number.
mrpt::math::CMatrixDouble44 getInverseHomogeneousMatrix() const
A numeric matrix of compile-time fixed size.
double norm() const
Returns the euclidean norm of vector: .
double sqrDistanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the squared euclidean distance to another pose/point:
void getInverseHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 inverse homogeneous transformation matrix for this point or pose...
void x_incr(const double v)
The base template class for 2D & 3D points and poses.
double distance2DTo(double ax, double ay) const
Returns the 2D distance from this pose/point to a 2D point (ignores Z, if it exists).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void homogeneousMatrixInverse(const MATRIXLIKE1 &M, MATRIXLIKE2 &out_inverse_M)
Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part...
T square(const T x)
Inline function for the square of a number.
double distance3DToSquare(double ax, double ay, double az) const
Returns the squared 3D distance from this pose/point to a 3D point.
virtual void setToNaN()=0
Set all data fields to quiet NaN.
double distance2DToSquare(double ax, double ay) const
Returns the squared 2D distance from this pose/point to a 2D point (ignores Z, if it exists)...
double distance3DTo(double ax, double ay, double az) const
Returns the 3D distance from this pose/point to a 3D point.