MRPT logo

mrpt::poses::CPoseOrPoint Class Reference

The base class for 2D points, 3D points, 2D poses and 3D poses. More...

#include <mrpt/poses/CPoseOrPoint.h>

Inheritance diagram for mrpt::poses::CPoseOrPoint:

mrpt::utils::CSerializable mrpt::poses::CPoint mrpt::poses::CPose mrpt::poses::CPoint2D mrpt::poses::CPoint3D mrpt::poses::CPose2D mrpt::poses::CPose3D

List of all members.

Public Member Functions

 CPoseOrPoint ()
double x () const
 Get the X coordinate.
double y () const
 Get the Y coordinate.
double z () const
 Get the Z coordinate.
virtual void x (const double x_)
 Set the X coordinate.
virtual void y (const double y_)
 Set the Y coordinate.
virtual void z (const double z_)
 Set the Z coordinate.
virtual void x_incr (const double Ax)
 Increment the X coordinate.
virtual void y_incr (const double Ay)
 Increment the Y coordinate.
virtual void z_incr (const double Az)
 Increment the Z coordinate.
bool is3DPoseOrPoint () const
 Return true for poses or points with a Z component, false otherwise.
double distanceTo (const CPoseOrPoint &b) const
 Returns the euclidean distance to another pose/point:.
double distanceTo (const mrpt::math::TPoint3D &b) const
 Returns the euclidean distance to another pose/point:.
double sqrDistanceTo (const CPoseOrPoint &b) const
 Returns the squared euclidean distance to another pose/point:.
double norm () const
 Returns the euclidean norm of vector: $ ||\mathbf{x}|| = \sqrt{x^2_1+y^2_i+...} $.
virtual void operator*= (const double &s)=0
 Scalar multiplication.
virtual void getAsVector (vector_double &v) const =0
 Return the pose or point as a 1xN vector with all the components (see derived classes for each implementation).
vector_double getAsVectorVal () const
 Return the pose or point as a 1xN vector with all the components (see derived classes for each implementation).
CMatrixDouble44 getHomogeneousMatrixVal () const
 Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).
virtual void getHomogeneousMatrix (CMatrixDouble44 &out_HM) const =0
 Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).
void getInverseHomogeneousMatrix (math::CMatrixDouble44 &out_HM) const
 Returns the corresponding inverse homogeneous transformation matrix for the point(translation), or pose (translation+orientation).
double distance2DTo (double ax, double ay) const
 Returns the 2D distance from this pose/point to another given by its coordinates:.
double distance3DTo (double ax, double ay, double az) const
 Returns the 3D distance from this pose/point to another given by its coordinates:.
double distance2DToSquare (double ax, double ay) const
 Returns the square of the 2D distance from this pose/point to another given by its coordinates:.
double distance3DToSquare (double ax, double ay, double az) const
 Returns the square of the the 3D distance from this pose/point to another given by its coordinates:.

Protected Attributes

bool m_is3D
 Will be false for 2D points or poses, and true for 3D points or poses.
double m_x
double m_y
double m_z
 The x y and z coordinates of the point or pose.


Detailed Description

The base class for 2D points, 3D points, 2D poses and 3D poses.

The common part defined in this base is the N-dimensional (N=2,3) position vector. The existence of orientation angles is left to derived classes. In this class euclidean distance methods and operators are implemented.

For more information and examples, refer to the 2D/3D Geometry tutorial in the wiki.

Introduction to 2D and 3D representation classes


There are two class of spatial representation classes:

Operators: There are operators defined for the pose compounding (+) and inverse pose compounding (-) of poses and points. For example, let "a" and "b" be 2D or 3D poses. Then "a+b" returns the resulting pose of "moving b" from "a"; and "b-a" returns the pose of "b" as it is seen "from a". They can be mixed points and poses, being 2D or 3D, in these operators, with the following results:

Does "a+b"returns a Pose or a Point?
a \ b Pose Point
Pose Pose Point
Point Pose Point

Does "a-b"returns a Pose or a Point?
a \ b Pose Point
Pose Pose Pose
Point Point Point

Does "a+b"(and "a-b") returns a 2D or a 3D object?
a \ b 2D 3D
2D 2D 3D
3D 3D 3D


Homogeneous matrices: The matrices computation follows the equations that can be found in any introductory text to spatial orientations, which are exposed next:

poses::CPoint2D

Homogeneous transfomation matrix

Spatial representation

1

0

0

x

0

1

0

y

0

0

1

0

0

0

0

1

CPoint2D.gif

poses::CPoint3D

Homogeneous transfomation matrix

Spatial representation

1

0

0

x

0

1

0

y

0

0

1

z

0

0

0

1

CPoint3D.gif

poses::CPose2D

Homogeneous transfomation matrix

Spatial representation

cosj

-sinj

0

x

sinj

cosj

0

y

0

0

1

0

0

0

0

1

CPose2D.gif

poses::CPose3D

Homogeneous transfomation matrix

Spatial representation

cycp

cyspsr-sycr

cyspcr+sysr

x

sycp

syspsr+cycr

syspcr-cysr

y

-sp

cpsr

cpcr

z

0

0

0

1

where:

cy = cos Yaw ;  sy = sin Yaw

cp = cos Pitch ; sp = sin Pitch

cr = cos Roll ; sr = sin Roll

CPose3D.gif

See also:
CPose,CPoint

Definition at line 564 of file CPoseOrPoint.h.


Constructor & Destructor Documentation

mrpt::poses::CPoseOrPoint::CPoseOrPoint (  )  [inline]

Definition at line 574 of file CPoseOrPoint.h.


Member Function Documentation

double mrpt::poses::CPoseOrPoint::distance2DTo ( double  ax,
double  ay 
) const [inline]

Returns the 2D distance from this pose/point to another given by its coordinates:.

See also:
distance2DToSquare,distance3DTo

Definition at line 663 of file CPoseOrPoint.h.

References mrpt::utils::square().

double mrpt::poses::CPoseOrPoint::distance2DToSquare ( double  ax,
double  ay 
) const [inline]

Returns the square of the 2D distance from this pose/point to another given by its coordinates:.

See also:
distance2DTo,distance3DToSquare

Definition at line 673 of file CPoseOrPoint.h.

References mrpt::utils::square().

double mrpt::poses::CPoseOrPoint::distance3DTo ( double  ax,
double  ay,
double  az 
) const [inline]

Returns the 3D distance from this pose/point to another given by its coordinates:.

See also:
distance3DToSquare,distance2DTo

Definition at line 668 of file CPoseOrPoint.h.

References mrpt::utils::square().

double mrpt::poses::CPoseOrPoint::distance3DToSquare ( double  ax,
double  ay,
double  az 
) const [inline]

Returns the square of the the 3D distance from this pose/point to another given by its coordinates:.

See also:
distance3DTo,distance2DToSquare

Definition at line 678 of file CPoseOrPoint.h.

References mrpt::utils::square().

double mrpt::poses::CPoseOrPoint::distanceTo ( const mrpt::math::TPoint3D b  )  const [inline]

Returns the euclidean distance to another pose/point:.

Definition at line 604 of file CPoseOrPoint.h.

References mrpt::utils::square(), mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.

double mrpt::poses::CPoseOrPoint::distanceTo ( const CPoseOrPoint b  )  const [inline]

Returns the euclidean distance to another pose/point:.

Definition at line 595 of file CPoseOrPoint.h.

References m_is3D, m_x, m_y, m_z, and mrpt::utils::square().

virtual void mrpt::poses::CPoseOrPoint::getAsVector ( vector_double v  )  const [pure virtual]

Return the pose or point as a 1xN vector with all the components (see derived classes for each implementation).

Implemented in mrpt::poses::CPoint2D, mrpt::poses::CPoint3D, mrpt::poses::CPose2D, and mrpt::poses::CPose3D.

vector_double mrpt::poses::CPoseOrPoint::getAsVectorVal (  )  const [inline]

Return the pose or point as a 1xN vector with all the components (see derived classes for each implementation).

Definition at line 632 of file CPoseOrPoint.h.

virtual void mrpt::poses::CPoseOrPoint::getHomogeneousMatrix ( CMatrixDouble44 out_HM  )  const [pure virtual]

Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).

See also:
getHomogeneousMatrixVal, getInverseHomogeneousMatrix

Implemented in mrpt::poses::CPoint2D, mrpt::poses::CPoint3D, mrpt::poses::CPose2D, and mrpt::poses::CPose3D.

CMatrixDouble44 mrpt::poses::CPoseOrPoint::getHomogeneousMatrixVal (  )  const [inline]

Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).

See also:
getInverseHomogeneousMatrix

Definition at line 642 of file CPoseOrPoint.h.

void mrpt::poses::CPoseOrPoint::getInverseHomogeneousMatrix ( math::CMatrixDouble44 out_HM  )  const

Returns the corresponding inverse homogeneous transformation matrix for the point(translation), or pose (translation+orientation).

See also:
getHomogeneousMatrix

bool mrpt::poses::CPoseOrPoint::is3DPoseOrPoint (  )  const [inline]

Return true for poses or points with a Z component, false otherwise.

Definition at line 591 of file CPoseOrPoint.h.

double mrpt::poses::CPoseOrPoint::norm (  )  const

Returns the euclidean norm of vector: $ ||\mathbf{x}|| = \sqrt{x^2_1+y^2_i+...} $.

virtual void mrpt::poses::CPoseOrPoint::operator*= ( const double &  s  )  [pure virtual]

Scalar multiplication.

Implemented in mrpt::poses::CPoint, mrpt::poses::CPose2D, and mrpt::poses::CPose3D.

double mrpt::poses::CPoseOrPoint::sqrDistanceTo ( const CPoseOrPoint b  )  const [inline]

Returns the squared euclidean distance to another pose/point:.

Definition at line 613 of file CPoseOrPoint.h.

References m_is3D, m_x, m_y, m_z, and mrpt::utils::square().

virtual void mrpt::poses::CPoseOrPoint::x ( const double  x_  )  [inline, virtual]

Set the X coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 581 of file CPoseOrPoint.h.

double mrpt::poses::CPoseOrPoint::x (  )  const [inline]

Get the X coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 577 of file CPoseOrPoint.h.

Referenced by mrpt::slam::CPointsMap::insertPoint().

virtual void mrpt::poses::CPoseOrPoint::x_incr ( const double  Ax  )  [inline, virtual]

Increment the X coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 585 of file CPoseOrPoint.h.

virtual void mrpt::poses::CPoseOrPoint::y ( const double  y_  )  [inline, virtual]

Set the Y coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 582 of file CPoseOrPoint.h.

double mrpt::poses::CPoseOrPoint::y (  )  const [inline]

Get the Y coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 578 of file CPoseOrPoint.h.

Referenced by mrpt::slam::CPointsMap::insertPoint().

virtual void mrpt::poses::CPoseOrPoint::y_incr ( const double  Ay  )  [inline, virtual]

Increment the Y coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 586 of file CPoseOrPoint.h.

virtual void mrpt::poses::CPoseOrPoint::z ( const double  z_  )  [inline, virtual]

Set the Z coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 583 of file CPoseOrPoint.h.

double mrpt::poses::CPoseOrPoint::z (  )  const [inline]

Get the Z coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 579 of file CPoseOrPoint.h.

Referenced by mrpt::slam::CPointsMap::insertPoint().

virtual void mrpt::poses::CPoseOrPoint::z_incr ( const double  Az  )  [inline, virtual]

Increment the Z coordinate.

Reimplemented in mrpt::poses::CPose3D.

Definition at line 587 of file CPoseOrPoint.h.


Member Data Documentation

Will be false for 2D points or poses, and true for 3D points or poses.

Definition at line 570 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().

double mrpt::poses::CPoseOrPoint::m_x [protected]

Definition at line 571 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().

double mrpt::poses::CPoseOrPoint::m_y [protected]

Definition at line 571 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().

double mrpt::poses::CPoseOrPoint::m_z [protected]

The x y and z coordinates of the point or pose.

Definition at line 571 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().




Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009