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 distanceTo (const CPoseOrPoint &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 const math::CMatrixDoublegetHomogeneousMatrix () const =0
 Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation), or pose (translation+orientation).
virtual void getHomogeneousMatrix (const math::CMatrixDouble *&ptrHM) const =0
 Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation), or pose (translation+orientation).
void getInverseHomogeneousMatrix (math::CMatrixDouble &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:.

Public Attributes

double x
 The N-dimensional point coordinates.
double y
double z

Protected Attributes

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


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 560 of file CPoseOrPoint.h.


Constructor & Destructor Documentation

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

Definition at line 572 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 630 of file CPoseOrPoint.h.

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 640 of file CPoseOrPoint.h.

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 635 of file CPoseOrPoint.h.

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 645 of file CPoseOrPoint.h.

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

Returns the euclidean distance to another pose/point:.

Definition at line 581 of file CPoseOrPoint.h.

References is3D, x, y, and z.

virtual void mrpt::poses::CPoseOrPoint::getHomogeneousMatrix ( const math::CMatrixDouble *&  ptrHM  )  const [pure virtual]

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

See also:
getInverseHomogeneousMatrix

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

virtual const math::CMatrixDouble& mrpt::poses::CPoseOrPoint::getHomogeneousMatrix (  )  const [pure virtual]

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

See also:
getInverseHomogeneousMatrix

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

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

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

See also:
getHomogeneousMatrix

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 590 of file CPoseOrPoint.h.

References is3D, x, y, and z.


Member Data Documentation

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

Definition at line 569 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().

The N-dimensional point coordinates.

Definition at line 577 of file CPoseOrPoint.h.

Referenced by distanceTo(), mrpt::slam::CRobotSimulator::GetOdometry(), mrpt::slam::CRobotSimulator::GetRealPose(), and sqrDistanceTo().

Definition at line 577 of file CPoseOrPoint.h.

Referenced by distanceTo(), and sqrDistanceTo().




Page generated by Doxygen 1.5.9 for MRPT 0.6.5 SVN:exported at Thu May 21 04:14:55 UTC 2009