10 #ifndef __RDL_FRAME_POINT_HPP__
11 #define __RDL_FRAME_POINT_HPP__
179 this->
x() = point.
x();
180 this->
y() = point.
y();
181 this->
z() = point.
z();
195 double dx = this->
x() - point.
x();
196 double dy = this->
y() - point.
y();
197 double dz = this->
z() - point.
z();
198 return dx * dx + dy * dy + dz * dz;
212 if (plane < 0 || plane > 2)
214 throw std::runtime_error(
"FramePoint.distance2DSquared: Plane argument must be either 0, 1, or 2");
217 double dx = plane == 0 ? 0. : this->
x() - point.
x();
218 double dy = plane == 1 ? 0. : this->
y() - point.
y();
219 double dz = plane == 2 ? 0. : this->
z() - point.
z();
220 return dx * dx + dy * dy + dz * dz;
232 if (plane < 0 || plane > 2)
234 throw std::runtime_error(
"FramePoint.distance2DSquared: Plane argument must be either 0, 1, or 2");
237 double dx = plane == 0 ? 0. : this->
x() - point.
x();
238 double dy = plane == 1 ? 0. : this->
y() - point.
y();
239 double dz = plane == 2 ? 0. : this->
z() - point.
z();
240 return dx * dx + dy * dy + dz * dz;
250 double dx = this->
x() - point.
x();
251 double dy = this->
y() - point.
y();
252 double dz = this->
z() - point.
z();
253 return dx * dx + dy * dy + dz * dz;
314 return fabs(this->
x() - point.
x()) + fabs(this->
y() - point.
y()) + fabs(this->
z() - point.
z());
327 double dx = this->
x() - point.
x();
328 double dy = this->
y() - point.
y();
329 double dz = this->
z() - point.
z();
331 double tmp = fabs(dx) > fabs(dy) ? fabs(dx) : fabs(dy);
333 return tmp > fabs(dz) ? tmp : fabs(dz);
347 return std::abs(this->
x() - point.
x()) < epsilon && std::abs(this->
y() - point.
y()) < epsilon && std::abs(this->
z() - point.
z()) < epsilon;
357 return referenceFrame ==
point.getReferenceFrame() && std::abs(this->
x() - point.
x()) < epsilon && std::abs(this->
y() - point.
y()) < epsilon &&
358 std::abs(this->
z() - point.
z()) < epsilon;
366 template <
typename T>
379 template <
typename T>
416 template <
typename T>
423 template <
typename T>
441 if (lhs.
x() != rhs.
x())
446 if (lhs.
y() != rhs.
y())
451 if (lhs.
z() != rhs.
z())
486 output <<
"ReferenceFrame = " << framePoint.
getReferenceFrame()->getName() << std::endl;
487 output <<
"x = " << framePoint.
x() <<
" y = " << framePoint.
y() <<
" z = " << framePoint.
z() << std::endl;
490 typedef std::vector<FramePoint, Eigen::aligned_allocator<FramePoint>>
FramePointV;
An interface that objects with a ReferenceFrame extend to inherit the FrameObject::changeFrame method...
Definition: FrameObject.hpp:26
virtual void changeFrame(ReferenceFramePtr desiredFrame)
Change the ReferenceFrame this FrameObject is expressed in.
Definition: FrameObject.cpp:9
void checkReferenceFramesMatch(const FrameObject *frameObject) const
Check if two FrameObjects hold the same ReferenceFrame.
Definition: FrameObject.hpp:67
ReferenceFramePtr getReferenceFrame() const
Get a pointer to the reference frame this FrameObject is expressed in.
Definition: FrameObject.hpp:49
ReferenceFramePtr referenceFrame
Definition: FrameObject.hpp:78
A FramePoint is a 3D point that is expressed in a ReferenceFrame. To change the ReferenceFrame a Fram...
Definition: FramePoint.hpp:38
FramePoint & operator=(const FramePoint &p)
Definition: FramePoint.hpp:92
double distance2DSquared(const Point3d &point, int plane=2) const
Calculate the distance squared from this point to a Point3d.
Definition: FramePoint.hpp:230
Math::TransformableGeometricObject * getTransformableGeometricObject()
Return a pointer to this as base class type Math::TransformableGeometricObject. See FrameObject::chan...
Definition: FramePoint.hpp:122
FramePoint(ReferenceFramePtr referenceFrame, const Math::Point3d &point)
Constructor.
Definition: FramePoint.hpp:65
void operator+=(const FrameVector &v)
Definition: FramePoint.hpp:387
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,...
Definition: FramePoint.hpp:355
FramePoint(ReferenceFramePtr referenceFrame)
Constructor that initializes to (x,y,z) = (0,0,0)
Definition: FramePoint.hpp:81
double distanceSquared(const FramePoint &point) const
Calculate the distance squared between two FramePoints. .
Definition: FramePoint.hpp:191
FramePoint(ReferenceFramePtr referenceFrame, const double x, const double y, const double z)
Constructor.
Definition: FramePoint.hpp:47
double distanceL1(const FramePoint &point) const
Calculate the L1 distance between two FramePoints by .
Definition: FramePoint.hpp:310
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.
Definition: FramePoint.hpp:172
double distance(const Point3d &point) const
Calculate the distance to a Point3d.
Definition: FramePoint.hpp:299
~FramePoint()
Destructor.
Definition: FramePoint.hpp:104
FramePoint changeFrameAndCopy(ReferenceFramePtr referenceFrame) const
copy into new frame point and change the frame of that
Definition: FramePoint.hpp:132
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 poi...
Definition: FramePoint.hpp:144
double distance2DSquared(const FramePoint &point, int plane=2) const
Calculate the 2D distance squared between two FramePoints.
Definition: FramePoint.hpp:209
FramePoint()
Empty constructor that creates a point with ReferencFrame=nullptr and (x,y,z)=(0,0,...
Definition: FramePoint.hpp:88
void operator/=(const T scale)
Overloaded /= operator, performs this = this*scale.
Definition: FramePoint.hpp:380
bool epsilonEquals(const FramePoint &point, const double epsilon) const
Return true FramePoint argument is within epsilon of this, false otherwise.
Definition: FramePoint.hpp:344
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.
Definition: FramePoint.hpp:156
double distance2D(const FramePoint &point, int plane=2) const
Calculate the distance between two FramePoints. .
Definition: FramePoint.hpp:262
FramePoint(const FramePoint &framePoint)
Copy constructor.
Definition: FramePoint.hpp:73
double distance(const FramePoint &point) const
Calculate the distance between two FramePoints. .
Definition: FramePoint.hpp:276
double distanceLinf(const FramePoint &point) const
Calculate the LInfinity distance between two FramePoints by .
Definition: FramePoint.hpp:323
void operator-=(const FrameVector &v)
Definition: FramePoint.hpp:395
FramePoint(ReferenceFramePtr referenceFrame, Math::Vector3d v)
Constructor.
Definition: FramePoint.hpp:56
void operator*=(const T scale)
Overloaded *= operator, performs this = this*scala.
Definition: FramePoint.hpp:367
Math::Point3d point() const
Get as point3d.
Definition: FramePoint.hpp:112
double distanceSquared(const Point3d &point) const
Calculate the distance squared from this point to a Point3d.
Definition: FramePoint.hpp:248
double distance2D(const Point3d &point, int plane=2) const
Calculate the distance to a Point3d.
Definition: FramePoint.hpp:289
A FrameVector is a 3D vector with a ReferenceFrame, and all operations between FrameVectors and other...
Definition: FrameVector.hpp:31
Definition: Point3.hpp:26
EIGEN_STRONG_INLINE double & z()
Definition: Point3.hpp:276
EIGEN_STRONG_INLINE double & y()
Definition: Point3.hpp:266
EIGEN_STRONG_INLINE double & x()
Definition: Point3.hpp:256
EIGEN_STRONG_INLINE void set(const std::vector< double > &vector)
Definition: Point3.hpp:68
Definition: rdl_eigenmath.hpp:54
A custom exception for frame operations.
Definition: FrameExceptions.hpp:28
std::shared_ptr< ReferenceFrame > ReferenceFramePtr
Definition: ReferenceFrame.hpp:68
FramePoint operator-(FramePoint p, const FrameVector &v)
Definition: FramePoint.hpp:410
bool operator!=(const FramePoint &lhs, const FramePoint &rhs)
Check if two FramePoints are not equal.
Definition: FramePoint.hpp:479
std::vector< FramePoint, Eigen::aligned_allocator< FramePoint > > FramePointV
Definition: FramePoint.hpp:490
FramePoint operator+(FramePoint p, const FrameVector &v)
Definition: FramePoint.hpp:404
std::ostream & operator<<(std::ostream &output, const FramePoint &framePoint)
Definition: FramePoint.hpp:484
ForceVector operator*(const SpatialTransform &X, ForceVector f)
Operator for transforming a ForceVector. Calls the ForceVector::transform method.
Definition: ForceVector.hpp:248
bool operator==(const FramePoint &lhs, const FramePoint &rhs)
Check if two FramePoints are equal.
Definition: FramePoint.hpp:437
Namespace for all structures of the RobotDynamics library.
Definition: examples.hpp:19