Robot Dynamics Library
Public Member Functions | List of all members
RobotDynamics::Math::FramePoint Class Reference

A FramePoint is a 3D point that is expressed in a ReferenceFrame. To change the ReferenceFrame a FramePoint is expressed in, you may call the inhereted FrameObject::changeFrame method and supply it a pointer to the ReferenceFrame you wish to have the FramePoint expressed in. This class and its implementation are an adaptation of FramePoint.java by Jerry Pratt and the IHMC Robotics Group. More...

#include <FramePoint.hpp>

Inheritance diagram for RobotDynamics::Math::FramePoint:
Inheritance graph
[legend]
Collaboration diagram for RobotDynamics::Math::FramePoint:
Collaboration graph
[legend]

Public Member Functions

 FramePoint (ReferenceFramePtr referenceFrame, const double x, const double y, const double z)
 Constructor. More...
 
 FramePoint (ReferenceFramePtr referenceFrame, Math::Vector3d v)
 Constructor. More...
 
 FramePoint (ReferenceFramePtr referenceFrame, const Math::Point3d &point)
 Constructor. More...
 
 FramePoint (const FramePoint &framePoint)
 Copy constructor. More...
 
 FramePoint (ReferenceFramePtr referenceFrame)
 Constructor that initializes to (x,y,z) = (0,0,0) More...
 
 FramePoint ()
 Empty constructor that creates a point with ReferencFrame=nullptr and (x,y,z)=(0,0,0) More...
 
FramePointoperator= (const FramePoint &p)
 
 ~FramePoint ()
 Destructor. More...
 
Math::Point3d point () const
 Get as point3d. More...
 
Math::TransformableGeometricObjectgetTransformableGeometricObject ()
 Return a pointer to this as base class type Math::TransformableGeometricObject. See FrameObject::changeFrame for how this method is used. More...
 
FramePoint changeFrameAndCopy (ReferenceFramePtr referenceFrame) const
 copy into new frame point and change the frame of that More...
 
EIGEN_STRONG_INLINE void setIncludingFrame (const Math::Vector3d &v, ReferenceFramePtr referenceFrame)
 Set both the ReferenceFrame this object is expressed in as well as the (x,y,z) coordinates of the point. More...
 
void setIncludingFrame (const double x, const double y, const double z, ReferenceFramePtr referenceFrame)
 Set both the ReferenceFrame the point is expressed in as well as the (x,y,z) coordinates. More...
 
void setIncludingFrame (const Math::Point3d &point, ReferenceFramePtr referenceFrame)
 Set both the ReferenceFrame the point is expressed in as well as the (x,y,z) coordinates. More...
 
double distanceSquared (const FramePoint &point) const
 Calculate the distance squared between two FramePoints. $\Delta_x^2+\Delta_y^2+\Delta_z^2$. More...
 
double distance2DSquared (const FramePoint &point, int plane=2) const
 Calculate the 2D distance squared between two FramePoints. More...
 
double distance2DSquared (const Point3d &point, int plane=2) const
 Calculate the distance squared from this point to a Point3d. More...
 
double distanceSquared (const Point3d &point) const
 Calculate the distance squared from this point to a Point3d. More...
 
double distance2D (const FramePoint &point, int plane=2) const
 Calculate the distance between two FramePoints. $\sqrt{\Delta_x^2+\Delta_y^2+\Delta_z^2}$. More...
 
double distance (const FramePoint &point) const
 Calculate the distance between two FramePoints. $\sqrt{\Delta_x^2+\Delta_y^2+\Delta_z^2}$. More...
 
double distance2D (const Point3d &point, int plane=2) const
 Calculate the distance to a Point3d. More...
 
double distance (const Point3d &point) const
 Calculate the distance to a Point3d. More...
 
double distanceL1 (const FramePoint &point) const
 Calculate the L1 distance between two FramePoints by $|\Delta_x| + |\Delta_y| + |\Delta_z|$. More...
 
double distanceLinf (const FramePoint &point) const
 Calculate the LInfinity distance between two FramePoints by $max(|\Delta_x|,|\Delta_y|,|\Delta_z|)$. More...
 
bool epsilonEquals (const FramePoint &point, const double epsilon) const
 Return true FramePoint argument is within epsilon of this, false otherwise. More...
 
bool isApprox (const FramePoint &point, const double epsilon) const
 Return true FramePoint argument is within epsilon of this and they have the same reference frame, false otherwise. More...
 
template<typename T >
void operator*= (const T scale)
 Overloaded *= operator, performs this = this*scala. More...
 
template<typename T >
void operator/= (const T scale)
 Overloaded /= operator, performs this = this*scale. More...
 
void operator+= (const FrameVector &v)
 
void operator-= (const FrameVector &v)
 
- Public Member Functions inherited from RobotDynamics::FrameObject
 FrameObject (ReferenceFramePtr referenceFrame)
 
virtual ~FrameObject ()
 Destructor. More...
 
virtual void changeFrame (ReferenceFramePtr desiredFrame)
 Change the ReferenceFrame this FrameObject is expressed in. More...
 
ReferenceFramePtr getReferenceFrame () const
 Get a pointer to the reference frame this FrameObject is expressed in. More...
 
void setReferenceFrame (ReferenceFramePtr frame)
 Set frame objects internal reference frame. More...
 
void checkReferenceFramesMatch (const FrameObject *frameObject) const
 Check if two FrameObjects hold the same ReferenceFrame. More...
 
void checkReferenceFramesMatch (FrameObject *frameObject) const
 
- Public Member Functions inherited from RobotDynamics::Math::Point3d
 Point3d (const double x, const double y, const double z)
 
 Point3d (const Point3d &point)
 
 Point3d (const Vector3d &vector)
 
EIGEN_STRONG_INLINE Point3d ()
 
virtual ~Point3d ()
 
void transform (const Math::SpatialTransform &X)
 Performs in place point transform. Given a point, $p$, this performs $ p = -X.E X.r + X.E p $. More...
 
Point3d transform_copy (const Math::SpatialTransform &X) const
 
EIGEN_STRONG_INLINE void set (const std::vector< double > &vector)
 
EIGEN_STRONG_INLINE void set (const Point3d &point)
 
void set (const Math::Vector3d &v)
 
void set (const double x, const double y, const double z)
 
EIGEN_STRONG_INLINE void setToZero ()
 
EIGEN_STRONG_INLINE bool epsilonEquals (const Point3d &point, const double epsilon) const
 
void clampMin (const double min)
 clamp any values that are less than min to min More...
 
void clampMax (const double max)
 clamp any values that are greater than make to max More...
 
void clampMinMax (const double min, const double max)
 clamp any values greater than max to max, and any value less than min to min More...
 
void absoluteValue ()
 Set each element to the absolute value. More...
 
double distance2DSquared (const Point3d &point, int plane=2) const
 Square of the 2d distance between two points. More...
 
double distanceSquared (const Point3d &point) const
 Square of the distance between two points, $ x^2 + y^2 + z^2 $. More...
 
double distance2D (const Point3d &point, int plane=2) const
 
double distance (const Point3d &point) const
 
double distanceL1 (const Point3d &point) const
 L1 norm of two points. More...
 
Vector3d cross (const Vector3d &v)
 Cross product between a point and vector. More...
 
double distanceLinf (const Point3d &point) const
 
EIGEN_STRONG_INLINE double & x ()
 
EIGEN_STRONG_INLINE double x () const
 
EIGEN_STRONG_INLINE double & y ()
 
EIGEN_STRONG_INLINE double y () const
 
EIGEN_STRONG_INLINE double & z ()
 
EIGEN_STRONG_INLINE double z () const
 
EIGEN_STRONG_INLINE double * data ()
 
EIGEN_STRONG_INLINE Math::Vector3d vec () const
 
Point3doperator= (const Point3d &other)
 
template<typename T >
void operator*= (const T scale)
 
template<typename T >
void operator/= (const T scale)
 
bool operator== (const Point3d &rhs)
 
bool operator!= (const Point3d &rhs)
 
void operator+= (const Vector3d &v)
 
void operator-= (const Vector3d &v)
 

Additional Inherited Members

- Protected Attributes inherited from RobotDynamics::FrameObject
ReferenceFramePtr referenceFrame
 
- Protected Attributes inherited from RobotDynamics::Math::Point3d
double point [3]
 

Detailed Description

A FramePoint is a 3D point that is expressed in a ReferenceFrame. To change the ReferenceFrame a FramePoint is expressed in, you may call the inhereted FrameObject::changeFrame method and supply it a pointer to the ReferenceFrame you wish to have the FramePoint expressed in. This class and its implementation are an adaptation of FramePoint.java by Jerry Pratt and the IHMC Robotics Group.

Constructor & Destructor Documentation

◆ FramePoint() [1/6]

RobotDynamics::Math::FramePoint::FramePoint ( ReferenceFramePtr  referenceFrame,
const double  x,
const double  y,
const double  z 
)
inline

Constructor.

Parameters
referenceFrameA pointer to the ReferenceFrame the point will be expressed in
xThe x-component of the point
yThe y-component of the point
zThe z-component of the point

◆ FramePoint() [2/6]

RobotDynamics::Math::FramePoint::FramePoint ( ReferenceFramePtr  referenceFrame,
Math::Vector3d  v 
)
inline

Constructor.

Parameters
referenceFrameA pointer to the ReferenceFrame the point will be expressed in
vA Vector3d that will be used to set the components of this FramePoint

◆ FramePoint() [3/6]

RobotDynamics::Math::FramePoint::FramePoint ( ReferenceFramePtr  referenceFrame,
const Math::Point3d point 
)
inline

Constructor.

Parameters
referenceFrameA pointer to the ReferenceFrame the point will be expressed in
pointA Math::Point3 that will be used to set the components of this FramePoint

◆ FramePoint() [4/6]

RobotDynamics::Math::FramePoint::FramePoint ( const FramePoint framePoint)
inline

Copy constructor.

Parameters
framePointA FramePoint to copy

◆ FramePoint() [5/6]

RobotDynamics::Math::FramePoint::FramePoint ( ReferenceFramePtr  referenceFrame)
inlineexplicit

Constructor that initializes to (x,y,z) = (0,0,0)

Parameters
referenceFrameA pointer to the ReferenceFrame the point will be expressed in

◆ FramePoint() [6/6]

RobotDynamics::Math::FramePoint::FramePoint ( )
inline

Empty constructor that creates a point with ReferencFrame=nullptr and (x,y,z)=(0,0,0)

◆ ~FramePoint()

RobotDynamics::Math::FramePoint::~FramePoint ( )
inline

Destructor.

Member Function Documentation

◆ changeFrameAndCopy()

FramePoint RobotDynamics::Math::FramePoint::changeFrameAndCopy ( ReferenceFramePtr  referenceFrame) const
inline

copy into new frame point and change the frame of that

Parameters
referenceFrame
Returns

◆ distance() [1/2]

double RobotDynamics::Math::FramePoint::distance ( const FramePoint point) const
inline

Calculate the distance between two FramePoints. $\sqrt{\Delta_x^2+\Delta_y^2+\Delta_z^2}$.

Parameters
plane2 = z, 1 = y, 0 = x. Defaults to 2 which is the z = 0 plane
pointFramePoint to calculate distance to
Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Returns
Distance between points

◆ distance() [2/2]

double RobotDynamics::Math::FramePoint::distance ( const Point3d point) const
inline

Calculate the distance to a Point3d.

Parameters
pointPoint3d to calculate distance to
Returns
Distance between points

◆ distance2D() [1/2]

double RobotDynamics::Math::FramePoint::distance2D ( const FramePoint point,
int  plane = 2 
) const
inline

Calculate the distance between two FramePoints. $\sqrt{\Delta_x^2+\Delta_y^2+\Delta_z^2}$.

Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Parameters
pointFramePoint to calculate distance to
Returns
Distance between points as template type T

◆ distance2D() [2/2]

double RobotDynamics::Math::FramePoint::distance2D ( const Point3d point,
int  plane = 2 
) const
inline

Calculate the distance to a Point3d.

Parameters
pointPoint3d to calculate distance to
plane2 = z, 1 = y, 0 = x. Defaults to 2 which is the z = 0 plane
Returns
Distance between points

◆ distance2DSquared() [1/2]

double RobotDynamics::Math::FramePoint::distance2DSquared ( const FramePoint point,
int  plane = 2 
) const
inline

Calculate the 2D distance squared between two FramePoints.

Parameters
pointFramePoint to calculate squared distance to
plane,2= z, 1 = y, 0 = x. Defaults to 2 which is the z = 0 plane
Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
std::runtime_errorif the plane argument is less than zero or greater than 2
Returns
Distance squared

◆ distance2DSquared() [2/2]

double RobotDynamics::Math::FramePoint::distance2DSquared ( const Point3d point,
int  plane = 2 
) const
inline

Calculate the distance squared from this point to a Point3d.

Parameters
pointPoint3d to calculate squared distance to
plane,2= z, 1 = y, 0 = x. Defaults to 2 which is the z = 0 plane
Exceptions
std::runtime_errorif the plane argument is less than zero or greater than 2
Returns
Distance squared

◆ distanceL1()

double RobotDynamics::Math::FramePoint::distanceL1 ( const FramePoint point) const
inline

Calculate the L1 distance between two FramePoints by $|\Delta_x| + |\Delta_y| + |\Delta_z|$.

Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Parameters
pointFramePoint to calculate distance to
Returns
Distance between points as template type T

◆ distanceLinf()

double RobotDynamics::Math::FramePoint::distanceLinf ( const FramePoint point) const
inline

Calculate the LInfinity distance between two FramePoints by $max(|\Delta_x|,|\Delta_y|,|\Delta_z|)$.

Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Parameters
pointFramePoint to calculate distance to
Returns
Distance between points as template type T

◆ distanceSquared() [1/2]

double RobotDynamics::Math::FramePoint::distanceSquared ( const FramePoint point) const
inline

Calculate the distance squared between two FramePoints. $\Delta_x^2+\Delta_y^2+\Delta_z^2$.

Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Parameters
pointFramePoint to calculate squared distance to
Returns
Distance squared

◆ distanceSquared() [2/2]

double RobotDynamics::Math::FramePoint::distanceSquared ( const Point3d point) const
inline

Calculate the distance squared from this point to a Point3d.

Parameters
pointPoint3d to calculate squared distance to
Returns
Distance squared

◆ epsilonEquals()

bool RobotDynamics::Math::FramePoint::epsilonEquals ( const FramePoint point,
const double  epsilon 
) const
inline

Return true FramePoint argument is within epsilon of this, false otherwise.

Parameters
pointThe FramePoint to be compared
epsilonThe tolerance of the comparison check
Exceptions
ReferenceFrameExceptionIf both points are not expressed in the same ReferenceFrame
Deprecated:
prefer isApprox instead

◆ getTransformableGeometricObject()

Math::TransformableGeometricObject* RobotDynamics::Math::FramePoint::getTransformableGeometricObject ( )
inlinevirtual

Return a pointer to this as base class type Math::TransformableGeometricObject. See FrameObject::changeFrame for how this method is used.

Returns
Pointer to this object as type Math::TransformableGeometricObject

Implements RobotDynamics::FrameObject.

◆ isApprox()

bool RobotDynamics::Math::FramePoint::isApprox ( const FramePoint point,
const double  epsilon 
) const
inline

Return true FramePoint argument is within epsilon of this and they have the same reference frame, false otherwise.

Parameters
pointThe FramePoint to be compared
epsilonThe tolerance of the comparison check

◆ operator*=()

template<typename T >
void RobotDynamics::Math::FramePoint::operator*= ( const T  scale)
inline

Overloaded *= operator, performs this = this*scala.

Parameters
scaleScalar to scale each element of this FramePoint by
Returns
FramePoint representing this = this*scale

◆ operator+=()

void RobotDynamics::Math::FramePoint::operator+= ( const FrameVector v)
inline

◆ operator-=()

void RobotDynamics::Math::FramePoint::operator-= ( const FrameVector v)
inline

◆ operator/=()

template<typename T >
void RobotDynamics::Math::FramePoint::operator/= ( const T  scale)
inline

Overloaded /= operator, performs this = this*scale.

Parameters
scaleScalar to divide each element of this FramePoint by
Returns
FramePoint representing this = this/scale

◆ operator=()

FramePoint& RobotDynamics::Math::FramePoint::operator= ( const FramePoint p)
inline

◆ point()

Math::Point3d RobotDynamics::Math::FramePoint::point ( ) const
inline

Get as point3d.

Returns
Point as Point3d type

◆ setIncludingFrame() [1/3]

void RobotDynamics::Math::FramePoint::setIncludingFrame ( const double  x,
const double  y,
const double  z,
ReferenceFramePtr  referenceFrame 
)
inline

Set both the ReferenceFrame the point is expressed in as well as the (x,y,z) coordinates.

Parameters
xThe x coordinate
yThe y coordinate
zThe z coordinate
referenceFrameThe ReferenceFrame this point is to be expressed in

◆ setIncludingFrame() [2/3]

void RobotDynamics::Math::FramePoint::setIncludingFrame ( const Math::Point3d point,
ReferenceFramePtr  referenceFrame 
)
inline

Set both the ReferenceFrame the point is expressed in as well as the (x,y,z) coordinates.

Parameters
pointMath::Point3d to set this point to
referenceFramePointer to ReferenceFrame this point will be expressed in

◆ setIncludingFrame() [3/3]

EIGEN_STRONG_INLINE void RobotDynamics::Math::FramePoint::setIncludingFrame ( const Math::Vector3d v,
ReferenceFramePtr  referenceFrame 
)
inline

Set both the ReferenceFrame this object is expressed in as well as the (x,y,z) coordinates of the point.

Parameters
vVector3d that this point will be set to
referenceFramePointer to the ReferenceFrame this object will be expressed in

The documentation for this class was generated from the following file: