MRPT
2.0.4
|
Lightweight SE(2)/SE(3) data types, geometry functions, etc.
"lightweight" point & pose classes
The "lightweight" name comes from the fact that these classes are simple structures without special memory alignment requirements and do not have a deep hiearchy of class heritance.
This is in contrast to classes derived from mrpt::poses::CPoseOrPoint, which in turn offer:
See list of classes below.
Classes | |
class | mrpt::math::CPolygon |
A wrapper of a TPolygon2D class, implementing CSerializable. More... | |
struct | mrpt::math::TPoint2D_data< T > |
struct | mrpt::math::TPoint2D_< T > |
Base template for TPoint2D and TPoint2Df. More... | |
struct | mrpt::math::TPoint3D_< T > |
Base template for TPoint3D and TPoint3Df. More... | |
class | mrpt::math::TPolygonWithPlane |
Slightly heavyweight type to speed-up calculations with polygons in 3D. More... | |
struct | mrpt::math::TPoseOrPoint |
Base type of all TPoseXX and TPointXX classes in mrpt::math. More... | |
Typedefs | |
using | mrpt::math::TPoint2D = TPoint2D_< double > |
Lightweight 2D point. More... | |
Simple intersection operations, relying basically on geometrical | |
bool | mrpt::math::intersect (const TSegment3D &s1, const TSegment3D &s2, TObject3D &obj) |
Gets the intersection between two 3D segments. More... | |
bool | mrpt::math::intersect (const TSegment3D &s1, const TPlane &p2, TObject3D &obj) |
Gets the intersection between a 3D segment and a plane. More... | |
bool | mrpt::math::intersect (const TSegment3D &s1, const TLine3D &r2, TObject3D &obj) |
Gets the intersection between a 3D segment and a 3D line. More... | |
bool | mrpt::math::intersect (const TPlane &p1, const TSegment3D &s2, TObject3D &obj) |
Gets the intersection between a plane and a 3D segment. More... | |
bool | mrpt::math::intersect (const TPlane &p1, const TPlane &p2, TObject3D &obj) |
Gets the intersection between two planes. More... | |
bool | mrpt::math::intersect (const TPlane &p1, const TLine3D &p2, TObject3D &obj) |
Gets the intersection between a plane and a 3D line. More... | |
bool | mrpt::math::intersect (const TLine3D &r1, const TSegment3D &s2, TObject3D &obj) |
Gets the intersection between a 3D line and a 3D segment. More... | |
bool | mrpt::math::intersect (const TLine3D &r1, const TPlane &p2, TObject3D &obj) |
Gets the intersection between a 3D line and a plane. More... | |
bool | mrpt::math::intersect (const TLine3D &r1, const TLine3D &r2, TObject3D &obj) |
Gets the intersection between two 3D lines. More... | |
bool | mrpt::math::intersect (const TLine2D &r1, const TLine2D &r2, TObject2D &obj) |
Gets the intersection between two 2D lines. More... | |
bool | mrpt::math::intersect (const TLine2D &r1, const TSegment2D &s2, TObject2D &obj) |
Gets the intersection between a 2D line and a 2D segment. More... | |
bool | mrpt::math::intersect (const TSegment2D &s1, const TLine2D &r2, TObject2D &obj) |
Gets the intersection between a 2D line and a 2D segment. More... | |
bool | mrpt::math::intersect (const TSegment2D &s1, const TSegment2D &s2, TObject2D &obj) |
Gets the intersection between two 2D segments. More... | |
Angle retrieval methods. Methods which use TSegments will | |
double | mrpt::math::getAngle (const TPlane &p1, const TPlane &p2) |
Computes the angle between two planes. More... | |
double | mrpt::math::getAngle (const TPlane &p1, const TLine3D &r2) |
Computes the angle between a plane and a 3D line or segment (implicit constructor will be used if passing a segment instead of a line). More... | |
double | mrpt::math::getAngle (const TLine3D &r1, const TPlane &p2) |
Computes the angle between a 3D line or segment and a plane (implicit constructor will be used if passing a segment instead of a line). More... | |
double | mrpt::math::getAngle (const TLine3D &r1, const TLine3D &r2) |
Computes the accute relative angle (range: [-PI/2,PI/2]) between two lines. More... | |
double | mrpt::math::getAngle (const TLine2D &r1, const TLine2D &r2) |
Computes the relative angle (range: [-PI,PI]) of line 2 wrt line 1. More... | |
Creation of lines from poses. | |
void | mrpt::math::createFromPoseX (const mrpt::math::TPose3D &p, TLine3D &r) |
Gets a 3D line corresponding to the X axis in a given pose. More... | |
void | mrpt::math::createFromPoseY (const mrpt::math::TPose3D &p, TLine3D &r) |
Gets a 3D line corresponding to the Y axis in a given pose. More... | |
void | mrpt::math::createFromPoseZ (const mrpt::math::TPose3D &p, TLine3D &r) |
Gets a 3D line corresponding to the Z axis in a given pose. More... | |
void | mrpt::math::createFromPoseAndVector (const mrpt::math::TPose3D &p, const double(&vector)[3], TLine3D &r) |
Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose. More... | |
void | mrpt::math::createFromPoseX (const TPose2D &p, TLine2D &r) |
Gets a 2D line corresponding to the X axis in a given pose. More... | |
void | mrpt::math::createFromPoseY (const TPose2D &p, TLine2D &r) |
Gets a 2D line corresponding to the Y axis in a given pose. More... | |
void | mrpt::math::createFromPoseAndVector (const TPose2D &p, const double(&vector)[2], TLine2D &r) |
Gets a 2D line corresponding to any arbitrary vector, in the base given the given pose. More... | |
Other line or plane related methods. | |
bool | mrpt::math::conformAPlane (const std::vector< TPoint3D > &points) |
Checks whether this polygon or set of points acceptably fits a plane. More... | |
bool | mrpt::math::conformAPlane (const std::vector< TPoint3D > &points, TPlane &p) |
Checks whether this polygon or set of points acceptably fits a plane, and if it's the case returns it in the second argument. More... | |
bool | mrpt::math::areAligned (const std::vector< TPoint2D > &points) |
Checks whether this set of points acceptably fits a 2D line. More... | |
bool | mrpt::math::areAligned (const std::vector< TPoint2D > &points, TLine2D &r) |
Checks whether this set of points acceptably fits a 2D line, and if it's the case returns it in the second argument. More... | |
bool | mrpt::math::areAligned (const std::vector< TPoint3D > &points) |
Checks whether this set of points acceptably fits a 3D line. More... | |
bool | mrpt::math::areAligned (const std::vector< TPoint3D > &points, TLine3D &r) |
Checks whether this set of points acceptably fits a 3D line, and if it's the case returns it in the second argument. More... | |
Projections | |
void | mrpt::math::project3D (const TPoint3D &point, const mrpt::math::TPose3D &newXYpose, TPoint3D &newPoint) |
Uses the given pose 3D to project a point into a new base. More... | |
void | mrpt::math::project3D (const TSegment3D &segment, const mrpt::math::TPose3D &newXYpose, TSegment3D &newSegment) |
Uses the given pose 3D to project a segment into a new base. More... | |
void | mrpt::math::project3D (const TLine3D &line, const mrpt::math::TPose3D &newXYpose, TLine3D &newLine) |
Uses the given pose 3D to project a line into a new base. More... | |
void | mrpt::math::project3D (const TPlane &plane, const mrpt::math::TPose3D &newXYpose, TPlane &newPlane) |
Uses the given pose 3D to project a plane into a new base. More... | |
void | mrpt::math::project3D (const TPolygon3D &polygon, const mrpt::math::TPose3D &newXYpose, TPolygon3D &newPolygon) |
Uses the given pose 3D to project a polygon into a new base. More... | |
void | mrpt::math::project3D (const TObject3D &object, const mrpt::math::TPose3D &newXYPose, TObject3D &newObject) |
Uses the given pose 3D to project any 3D object into a new base. More... | |
template<class T > | |
void | mrpt::math::project3D (const T &obj, const TPlane &newXYPlane, T &newObj) |
Projects any 3D object into the plane's base, using its inverse pose. More... | |
template<class T > | |
void | mrpt::math::project3D (const T &obj, const TPlane &newXYPlane, const TPoint3D &newOrigin, T &newObj) |
Projects any 3D object into the plane's base, using its inverse pose and forcing the position of the new coordinates origin. More... | |
template<class T > | |
void | mrpt::math::project3D (const std::vector< T > &objs, const mrpt::math::TPose3D &newXYpose, std::vector< T > &newObjs) |
Projects a set of 3D objects into the plane's base. More... | |
void | mrpt::math::project2D (const TPoint2D &point, const TPose2D &newXpose, TPoint2D &newPoint) |
Uses the given pose 2D to project a point into a new base. More... | |
void | mrpt::math::project2D (const TSegment2D &segment, const TPose2D &newXpose, TSegment2D &newSegment) |
Uses the given pose 2D to project a segment into a new base. More... | |
void | mrpt::math::project2D (const TLine2D &line, const TPose2D &newXpose, TLine2D &newLine) |
Uses the given pose 2D to project a line into a new base. More... | |
void | mrpt::math::project2D (const TPolygon2D &polygon, const TPose2D &newXpose, TPolygon2D &newPolygon) |
Uses the given pose 2D to project a polygon into a new base. More... | |
void | mrpt::math::project2D (const TObject2D &object, const TPose2D &newXpose, TObject2D &newObject) |
Uses the given pose 2D to project any 2D object into a new base. More... | |
template<class T , class CPOSE2D > | |
void | mrpt::math::project2D (const T &obj, const TLine2D &newXLine, T &newObj) |
Projects any 2D object into the line's base, using its inverse pose. More... | |
template<class T , class CPOSE2D > | |
void | mrpt::math::project2D (const T &obj, const TLine2D &newXLine, const TPoint2D &newOrigin, T &newObj) |
Projects any 2D object into the line's base, using its inverse pose and forcing the position of the new coordinate origin. More... | |
template<class T > | |
void | mrpt::math::project2D (const std::vector< T > &objs, const TPose2D &newXpose, std::vector< T > &newObjs) |
Projects a set of 2D objects into the line's base. More... | |
Polygon intersections. These operations rely more on spatial reasoning | |
bool | mrpt::math::intersect (const TPolygon2D &p1, const TSegment2D &s2, TObject2D &obj) |
Gets the intersection between a 2D polygon and a 2D segment. More... | |
bool | mrpt::math::intersect (const TPolygon2D &p1, const TLine2D &r2, TObject2D &obj) |
Gets the intersection between a 2D polygon and a 2D line. More... | |
bool | mrpt::math::intersect (const TPolygon2D &p1, const TPolygon2D &p2, TObject2D &obj) |
Gets the intersection between two 2D polygons. More... | |
bool | mrpt::math::intersect (const TSegment2D &s1, const TPolygon2D &p2, TObject2D &obj) |
Gets the intersection between a 2D segment and a 2D polygon. More... | |
bool | mrpt::math::intersect (const TLine2D &r1, const TPolygon2D &p2, TObject2D &obj) |
Gets the intersection between a 2D line and a 2D polygon. More... | |
bool | mrpt::math::intersect (const TPolygon3D &p1, const TSegment3D &s2, TObject3D &obj) |
Gets the intersection between a 3D polygon and a 3D segment. More... | |
bool | mrpt::math::intersect (const TPolygon3D &p1, const TLine3D &r2, TObject3D &obj) |
Gets the intersection between a 3D polygon and a 3D line. More... | |
bool | mrpt::math::intersect (const TPolygon3D &p1, const TPlane &p2, TObject3D &obj) |
Gets the intersection between a 3D polygon and a plane. More... | |
bool | mrpt::math::intersect (const TPolygon3D &p1, const TPolygon3D &p2, TObject3D &obj) |
Gets the intersection between two 3D polygons. More... | |
bool | mrpt::math::intersect (const TSegment3D &s1, const TPolygon3D &p2, TObject3D &obj) |
Gets the intersection between a 3D segment and a 3D polygon. More... | |
bool | mrpt::math::intersect (const TLine3D &r1, const TPolygon3D &p2, TObject3D &obj) |
Gets the intersection between a 3D line and a 3D polygon. More... | |
bool | mrpt::math::intersect (const TPlane &p1, const TPolygon3D &p2, TObject3D &obj) |
Gets the intersection between a plane and a 3D polygon. More... | |
size_t | mrpt::math::intersect (const std::vector< TPolygon3D > &v1, const std::vector< TPolygon3D > &v2, CSparseMatrixTemplate< TObject3D > &objs) |
Gets the intersection between two sets of 3D polygons. More... | |
size_t | mrpt::math::intersect (const std::vector< TPolygon3D > &v1, const std::vector< TPolygon3D > &v2, std::vector< TObject3D > &objs) |
Gets the intersection between two sets of 3D polygons. More... | |
Other intersections | |
template<class T , class U , class O > | |
size_t | mrpt::math::intersect (const std::vector< T > &v1, const std::vector< U > &v2, CSparseMatrixTemplate< O > &objs) |
Gets the intersection between vectors of geometric objects and returns it in a sparse matrix of either TObject2D or TObject3D. More... | |
template<class T , class U , class O > | |
size_t | mrpt::math::intersect (const std::vector< T > &v1, const std::vector< U > &v2, std::vector< O > objs) |
Gets the intersection between vectors of geometric objects and returns it in a vector of either TObject2D or TObject3D. More... | |
bool | mrpt::math::intersect (const TObject2D &o1, const TObject2D &o2, TObject2D &obj) |
Gets the intersection between any pair of 2D objects. More... | |
bool | mrpt::math::intersect (const TObject3D &o1, const TObject3D &o2, TObject3D &obj) |
Gets the intersection between any pair of 3D objects. More... | |
Distances | |
double | mrpt::math::distance (const TPoint2D &p1, const TPoint2D &p2) |
Gets the distance between two points in a 2D space. More... | |
double | mrpt::math::distance (const TPoint3D &p1, const TPoint3D &p2) |
Gets the distance between two points in a 3D space. More... | |
double | mrpt::math::distance (const TLine2D &r1, const TLine2D &r2) |
Gets the distance between two lines in a 2D space. More... | |
double | mrpt::math::distance (const TLine3D &r1, const TLine3D &r2) |
Gets the distance between two lines in a 3D space. More... | |
double | mrpt::math::distance (const TPlane &p1, const TPlane &p2) |
Gets the distance between two planes. More... | |
double | mrpt::math::distance (const TPolygon2D &p1, const TPolygon2D &p2) |
Gets the distance between two polygons in a 2D space. More... | |
double | mrpt::math::distance (const TPolygon2D &p1, const TSegment2D &s2) |
Gets the distance between a polygon and a segment in a 2D space. More... | |
double | mrpt::math::distance (const TSegment2D &s1, const TPolygon2D &p2) |
Gets the distance between a segment and a polygon in a 2D space. More... | |
double | mrpt::math::distance (const TPolygon2D &p1, const TLine2D &l2) |
Gets the distance between a polygon and a line in a 2D space. More... | |
double | mrpt::math::distance (const TLine2D &l1, const TPolygon2D &p2) |
double | mrpt::math::distance (const TPolygon3D &p1, const TPolygon3D &p2) |
Gets the distance between two polygons in a 3D space. More... | |
double | mrpt::math::distance (const TPolygon3D &p1, const TSegment3D &s2) |
Gets the distance between a polygon and a segment in a 3D space. More... | |
double | mrpt::math::distance (const TSegment3D &s1, const TPolygon3D &p2) |
Gets the distance between a segment and a polygon in a 3D space. More... | |
double | mrpt::math::distance (const TPolygon3D &p1, const TLine3D &l2) |
Gets the distance between a polygon and a line in a 3D space. More... | |
double | mrpt::math::distance (const TLine3D &l1, const TPolygon3D &p2) |
Gets the distance between a line and a polygon in a 3D space. More... | |
double | mrpt::math::distance (const TPolygon3D &po, const TPlane &pl) |
Gets the distance between a polygon and a plane. More... | |
double | mrpt::math::distance (const TPlane &pl, const TPolygon3D &po) |
Gets the distance between a plane and a polygon. More... | |
Bound checkers | |
void | mrpt::math::getRectangleBounds (const std::vector< TPoint2D > &poly, TPoint2D &pMin, TPoint2D &pMax) |
Gets the rectangular bounds of a 2D polygon or set of 2D points. More... | |
void | mrpt::math::getPrismBounds (const std::vector< TPoint3D > &poly, TPoint3D &pMin, TPoint3D &pMax) |
Gets the prism bounds of a 3D polygon or set of 3D points. More... | |
Creation of planes from poses | |
void | mrpt::math::createPlaneFromPoseXY (const mrpt::math::TPose3D &pose, TPlane &plane) |
Given a pose, creates a plane orthogonal to its Z vector. More... | |
void | mrpt::math::createPlaneFromPoseXZ (const mrpt::math::TPose3D &pose, TPlane &plane) |
Given a pose, creates a plane orthogonal to its Y vector. More... | |
void | mrpt::math::createPlaneFromPoseYZ (const mrpt::math::TPose3D &pose, TPlane &plane) |
Given a pose, creates a plane orthogonal to its X vector. More... | |
void | mrpt::math::createPlaneFromPoseAndNormal (const mrpt::math::TPose3D &pose, const double(&normal)[3], TPlane &plane) |
Given a pose and any vector, creates a plane orthogonal to that vector in the pose's coordinates. More... | |
CMatrixDouble44 | mrpt::math::generateAxisBaseFromDirectionAndAxis (const mrpt::math::TVector3D &vec, uint8_t coord) |
Creates a homogeneus matrix (4x4) such that the coordinate given (0 for x, 1 for y, 2 for z) corresponds to the provided vector. More... | |
Linear regression methods | |
double | mrpt::math::getRegressionLine (const std::vector< TPoint2D > &points, TLine2D &line) |
Using eigenvalues, gets the best fitting line for a set of 2D points. More... | |
double | mrpt::math::getRegressionLine (const std::vector< TPoint3D > &points, TLine3D &line) |
Using eigenvalues, gets the best fitting line for a set of 3D points. More... | |
double | mrpt::math::getRegressionPlane (const std::vector< TPoint3D > &points, TPlane &plane) |
Using eigenvalues, gets the best fitting plane for a set of 3D points. More... | |
Miscellaneous Geometry methods | |
void | mrpt::math::assemblePolygons (const std::vector< TSegment3D > &segms, std::vector< TPolygon3D > &polys) |
Tries to assemble a set of segments into a set of closed polygons. More... | |
void | mrpt::math::assemblePolygons (const std::vector< TSegment3D > &segms, std::vector< TPolygon3D > &polys, std::vector< TSegment3D > &remainder) |
Tries to assemble a set of segments into a set of closed polygons, returning the unused segments as another out parameter. More... | |
void | mrpt::math::assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys) |
Extracts all the polygons, including those formed from segments, from the set of objects. More... | |
void | mrpt::math::assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys, std::vector< TObject3D > &remainder) |
Extracts all the polygons, including those formed from segments, from the set of objects. More... | |
void | mrpt::math::assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys, std::vector< TSegment3D > &remainder1, std::vector< TObject3D > &remainder2) |
Extracts all the polygons, including those formed from segments, from the set of objects. More... | |
bool | mrpt::math::splitInConvexComponents (const TPolygon2D &poly, std::vector< TPolygon2D > &components) |
Splits a 2D polygon into convex components. More... | |
bool | mrpt::math::splitInConvexComponents (const TPolygon3D &poly, std::vector< TPolygon3D > &components) |
Splits a 3D polygon into convex components. More... | |
void | mrpt::math::getSegmentBisector (const TSegment2D &sgm, TLine2D &bis) |
Gets the bisector of a 2D segment. More... | |
void | mrpt::math::getSegmentBisector (const TSegment3D &sgm, TPlane &bis) |
Gets the bisector of a 3D segment. More... | |
void | mrpt::math::getAngleBisector (const TLine2D &l1, const TLine2D &l2, TLine2D &bis) |
Gets the bisector of two lines or segments (implicit constructor will be used if necessary) More... | |
void | mrpt::math::getAngleBisector (const TLine3D &l1, const TLine3D &l2, TLine3D &bis) |
Gets the bisector of two lines or segments (implicit constructor will be used if necessary) More... | |
bool | mrpt::math::traceRay (const std::vector< TPolygonWithPlane > &vec, const mrpt::math::TPose3D &pose, double &dist) |
Fast ray tracing method using polygons' properties. More... | |
bool | mrpt::math::traceRay (const std::vector< TPolygon3D > &vec, const mrpt::math::TPose3D &pose, double &dist) |
Fast ray tracing method using polygons' properties. More... | |
template<class T , class U , class V > | |
void | mrpt::math::crossProduct3D (const T &v0, const U &v1, V &vOut) |
Computes the cross product of two 3D vectors, returning a vector normal to both. More... | |
template<class T > | |
void | mrpt::math::crossProduct3D (const std::vector< T > &v0, const std::vector< T > &v1, std::vector< T > &v_out) |
template<class VEC1 , class VEC2 > | |
VEC1 | mrpt::math::crossProduct3D (const VEC1 &v0, const VEC2 &v1) |
overload (returning a vector of size 3 by value). More... | |
template<class VECTOR , class MATRIX > | |
void | mrpt::math::skew_symmetric3 (const VECTOR &v, MATRIX &M) |
Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array:
. More... | |
template<class VECTOR > | |
mrpt::math::CMatrixDouble33 | mrpt::math::skew_symmetric3 (const VECTOR &v) |
template<class VECTOR , class MATRIX > | |
void | mrpt::math::skew_symmetric3_neg (const VECTOR &v, MATRIX &M) |
Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array:
. More... | |
template<class VECTOR > | |
mrpt::math::CMatrixDouble33 | mrpt::math::skew_symmetric3_neg (const VECTOR &v) |
template<class T , class U > | |
bool | mrpt::math::vectorsAreParallel2D (const T &v1, const U &v2) |
Returns true if two 2D vectors are parallel. More... | |
template<class T , class U > | |
bool | mrpt::math::vectorsAreParallel3D (const T &v1, const U &v2) |
Returns true if two 3D vectors are parallel. More... | |
void | mrpt::math::closestFromPointToSegment (double Px, double Py, double x1, double y1, double x2, double y2, double &out_x, double &out_y) |
Computes the closest point from a given point to a segment. More... | |
void | mrpt::math::closestFromPointToLine (double Px, double Py, double x1, double y1, double x2, double y2, double &out_x, double &out_y) |
Computes the closest point from a given point to a (infinite) line. More... | |
double | mrpt::math::closestSquareDistanceFromPointToLine (double Px, double Py, double x1, double y1, double x2, double y2) |
Returns the square distance from a point to a line. More... | |
template<typename T > | |
T | mrpt::math::distanceBetweenPoints (const T x1, const T y1, const T x2, const T y2) |
Returns the distance between 2 points in 2D. More... | |
template<typename T > | |
T | mrpt::math::distanceBetweenPoints (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2) |
Returns the distance between 2 points in 3D. More... | |
template<typename T > | |
T | mrpt::math::distanceSqrBetweenPoints (const T x1, const T y1, const T x2, const T y2) |
Returns the square distance between 2 points in 2D. More... | |
template<typename T > | |
T | mrpt::math::distanceSqrBetweenPoints (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2) |
Returns the square distance between 2 points in 3D. More... | |
template<typename T > | |
double | mrpt::math::minimumDistanceFromPointToSegment (const double Px, const double Py, const double x1, const double y1, const double x2, const double y2, T &out_x, T &out_y) |
Computes the closest point from a given point to a segment, and returns that minimum distance. More... | |
bool | mrpt::math::SegmentsIntersection (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, const double x4, const double y4, double &ix, double &iy) |
Returns the intersection point, and if it exists, between two segments. More... | |
bool | mrpt::math::SegmentsIntersection (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, const double x4, const double y4, float &ix, float &iy) |
Returns the intersection point, and if it exists, between two segments. More... | |
bool | mrpt::math::pointIntoPolygon2D (double px, double py, unsigned int polyEdges, const double *poly_xs, const double *poly_ys) |
Returns true if the 2D point (px,py) falls INTO the given polygon. More... | |
template<typename T > | |
bool | mrpt::math::pointIntoQuadrangle (T x, T y, T v1x, T v1y, T v2x, T v2y, T v3x, T v3y, T v4x, T v4y) |
Specialized method to check whether a point (x,y) falls into a quadrangle. More... | |
double | mrpt::math::distancePointToPolygon2D (double px, double py, unsigned int polyEdges, const double *poly_xs, const double *poly_ys) |
Returns the closest distance of a given 2D point to a polygon, or "0" if the point is INTO the polygon or its perimeter. More... | |
bool | mrpt::math::minDistBetweenLines (double p1_x, double p1_y, double p1_z, double p2_x, double p2_y, double p2_z, double p3_x, double p3_y, double p3_z, double p4_x, double p4_y, double p4_z, double &x, double &y, double &z, double &dist) |
Calculates the minimum distance between a pair of lines. More... | |
bool | mrpt::math::RectanglesIntersection (double R1_x_min, double R1_x_max, double R1_y_min, double R1_y_max, double R2_x_min, double R2_x_max, double R2_y_min, double R2_y_max, double R2_pose_x, double R2_pose_y, double R2_pose_phi) |
Returns whether two rotated rectangles intersect. More... | |
CMatrixDouble33 | mrpt::math::generateAxisBaseFromDirection (double dx, double dy, double dz) |
Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of them ("X") NOTE: Make sure of passing all floats or doubles and that the template of the receiving matrix is of the same type! More... | |
SLERP (Spherical Linear Interpolation) functions | |
template<typename T > | |
void | mrpt::math::slerp (const CQuaternion< T > &q0, const CQuaternion< T > &q1, const double t, CQuaternion< T > &q) |
SLERP interpolation between two quaternions. More... | |
void | mrpt::math::slerp (const TPose3D &q0, const TPose3D &q1, const double t, TPose3D &p) |
SLERP interpolation between two 6D poses - like mrpt::math::slerp for quaternions, but interpolates the [X,Y,Z] coordinates as well. More... | |
void | mrpt::math::slerp_ypr (const mrpt::math::TPose3D &q0, const mrpt::math::TPose3D &q1, const double t, mrpt::math::TPose3D &p) |
typedef TPoint2D_< double > mrpt::math::TPoint2D |
Lightweight 2D point.
Allows coordinate access using [] operator.
Definition at line 213 of file TPoint2D.h.
bool mrpt::math::areAligned | ( | const std::vector< TPoint2D > & | points | ) |
Checks whether this set of points acceptably fits a 2D line.
Definition at line 990 of file geometry.cpp.
References geometryEpsilon, mrpt::math::MatrixBase< Scalar, Derived >::rank(), mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
Referenced by mrpt::math::areAligned().
Checks whether this set of points acceptably fits a 2D line, and if it's the case returns it in the second argument.
Definition at line 1005 of file geometry.cpp.
References mrpt::math::areAligned().
bool mrpt::math::areAligned | ( | const std::vector< TPoint3D > & | points | ) |
Checks whether this set of points acceptably fits a 3D line.
Definition at line 1022 of file geometry.cpp.
References geometryEpsilon, mrpt::math::MatrixBase< Scalar, Derived >::rank(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Checks whether this set of points acceptably fits a 3D line, and if it's the case returns it in the second argument.
Definition at line 1038 of file geometry.cpp.
References mrpt::math::areAligned().
void mrpt::math::assemblePolygons | ( | const std::vector< TSegment3D > & | segms, |
std::vector< TPolygon3D > & | polys | ||
) |
Tries to assemble a set of segments into a set of closed polygons.
Definition at line 2090 of file geometry.cpp.
Referenced by mrpt::math::assemblePolygons().
void mrpt::math::assemblePolygons | ( | const std::vector< TSegment3D > & | segms, |
std::vector< TPolygon3D > & | polys, | ||
std::vector< TSegment3D > & | remainder | ||
) |
Tries to assemble a set of segments into a set of closed polygons, returning the unused segments as another out parameter.
Definition at line 2184 of file geometry.cpp.
References depthFirstSearch(), mrpt::math::distance(), geometryEpsilon, and results.
void mrpt::math::assemblePolygons | ( | const std::vector< TObject3D > & | objs, |
std::vector< TPolygon3D > & | polys | ||
) |
Extracts all the polygons, including those formed from segments, from the set of objects.
Definition at line 2231 of file geometry.cpp.
References mrpt::math::assemblePolygons().
void mrpt::math::assemblePolygons | ( | const std::vector< TObject3D > & | objs, |
std::vector< TPolygon3D > & | polys, | ||
std::vector< TObject3D > & | remainder | ||
) |
Extracts all the polygons, including those formed from segments, from the set of objects.
Definition at line 2241 of file geometry.cpp.
References mrpt::math::assemblePolygons().
void mrpt::math::assemblePolygons | ( | const std::vector< TObject3D > & | objs, |
std::vector< TPolygon3D > & | polys, | ||
std::vector< TSegment3D > & | remainder1, | ||
std::vector< TObject3D > & | remainder2 | ||
) |
Extracts all the polygons, including those formed from segments, from the set of objects.
Definition at line 2254 of file geometry.cpp.
References mrpt::math::assemblePolygons().
void mrpt::math::closestFromPointToLine | ( | double | Px, |
double | Py, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double & | out_x, | ||
double & | out_y | ||
) |
Computes the closest point from a given point to a (infinite) line.
Definition at line 77 of file geometry.cpp.
Referenced by mrpt::maps::CPointsMap::squareDistanceToClosestCorrespondence().
void mrpt::math::closestFromPointToSegment | ( | double | Px, |
double | Py, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double & | out_x, | ||
double & | out_y | ||
) |
Computes the closest point from a given point to a segment.
Definition at line 39 of file geometry.cpp.
double mrpt::math::closestSquareDistanceFromPointToLine | ( | double | Px, |
double | Py, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Returns the square distance from a point to a line.
Definition at line 100 of file geometry.cpp.
References mrpt::square().
Referenced by mrpt::slam::CICP::ICP_Method_LM().
bool mrpt::math::conformAPlane | ( | const std::vector< TPoint3D > & | points | ) |
Checks whether this polygon or set of points acceptably fits a plane.
Definition at line 969 of file geometry.cpp.
References geometryEpsilon, mrpt::math::MatrixBase< Scalar, Derived >::rank(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Referenced by mrpt::math::TPolygon3D::getPlane(), mrpt::math::TPolygon3D::isSkew(), and TEST().
Checks whether this polygon or set of points acceptably fits a plane, and if it's the case returns it in the second argument.
Definition at line 985 of file geometry.cpp.
References geometryEpsilon, and mrpt::math::getRegressionPlane().
void mrpt::math::createFromPoseAndVector | ( | const mrpt::math::TPose3D & | p, |
const double(&) | vector[3], | ||
TLine3D & | r | ||
) |
Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose.
An implicit constructor is used if a TPose3D is given.
Definition at line 932 of file geometry.cpp.
References mrpt::math::TLine3D::director, mrpt::math::TPose3D::getHomogeneousMatrix(), and mrpt::math::TLine3D::pBase.
void mrpt::math::createFromPoseAndVector | ( | const TPose2D & | p, |
const double(&) | vector[2], | ||
TLine2D & | r | ||
) |
Gets a 2D line corresponding to any arbitrary vector, in the base given the given pose.
An implicit constructor is used if a CPose2D is given.
Definition at line 959 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TPose2D::phi, mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.
void mrpt::math::createFromPoseX | ( | const mrpt::math::TPose3D & | p, |
TLine3D & | r | ||
) |
Gets a 3D line corresponding to the X axis in a given pose.
An implicit constructor is used if a TPose3D is given.
Definition at line 917 of file geometry.cpp.
References createFromPoseAndAxis().
Referenced by mrpt::opengl::CCylinder::traceRay(), mrpt::opengl::CEllipsoid3D::traceRay(), mrpt::opengl::CEllipsoid2D::traceRay(), and mrpt::math::traceRay().
Gets a 2D line corresponding to the X axis in a given pose.
An implicit constructor is used if a CPose2D is given.
Definition at line 945 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TPose2D::phi, mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.
void mrpt::math::createFromPoseY | ( | const mrpt::math::TPose3D & | p, |
TLine3D & | r | ||
) |
Gets a 3D line corresponding to the Y axis in a given pose.
An implicit constructor is used if a TPose3D is given.
Definition at line 922 of file geometry.cpp.
References createFromPoseAndAxis().
Gets a 2D line corresponding to the Y axis in a given pose.
An implicit constructor is used if a CPose2D is given.
Definition at line 952 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TPose2D::phi, mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.
void mrpt::math::createFromPoseZ | ( | const mrpt::math::TPose3D & | p, |
TLine3D & | r | ||
) |
Gets a 3D line corresponding to the Z axis in a given pose.
An implicit constructor is used if a TPose3D is given.
Definition at line 927 of file geometry.cpp.
References createFromPoseAndAxis().
void mrpt::math::createPlaneFromPoseAndNormal | ( | const mrpt::math::TPose3D & | pose, |
const double(&) | normal[3], | ||
TPlane & | plane | ||
) |
Given a pose and any vector, creates a plane orthogonal to that vector in the pose's coordinates.
Definition at line 1979 of file geometry.cpp.
References mrpt::math::TPlane::coefs, and mrpt::math::TPose3D::getHomogeneousMatrix().
void mrpt::math::createPlaneFromPoseXY | ( | const mrpt::math::TPose3D & | pose, |
TPlane & | plane | ||
) |
Given a pose, creates a plane orthogonal to its Z vector.
Definition at line 1964 of file geometry.cpp.
References createPlaneFromPoseAndAxis().
void mrpt::math::createPlaneFromPoseXZ | ( | const mrpt::math::TPose3D & | pose, |
TPlane & | plane | ||
) |
Given a pose, creates a plane orthogonal to its Y vector.
Definition at line 1969 of file geometry.cpp.
References createPlaneFromPoseAndAxis().
void mrpt::math::createPlaneFromPoseYZ | ( | const mrpt::math::TPose3D & | pose, |
TPlane & | plane | ||
) |
Given a pose, creates a plane orthogonal to its X vector.
Definition at line 1974 of file geometry.cpp.
References createPlaneFromPoseAndAxis().
|
inline |
Computes the cross product of two 3D vectors, returning a vector normal to both.
It uses the simple implementation:
Definition at line 765 of file geometry.h.
Referenced by mrpt::opengl::TRenderMatrices::applyLookAt(), mrpt::math::distance(), mrpt::topography::ENUToGeocentric(), mrpt::vision::findMultipleChessboardsCorners(), mrpt::math::generateAxisBaseFromDirection(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::math::intersect(), mrpt::opengl::CPolyhedron::onUpdateBuffers_Triangles(), and mrpt::math::TPlane::TPlane().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 774 of file geometry.h.
|
inline |
overload (returning a vector of size 3 by value).
Definition at line 785 of file geometry.h.
References ASSERT_.
Gets the distance between two points in a 2D space.
Definition at line 1807 of file geometry.cpp.
References mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
Referenced by mrpt::math::assemblePolygons(), mrpt::detectors::CFaceDetection::checkIfDiagonalSurface(), mrpt::detectors::CFaceDetection::checkIfDiagonalSurface2(), mrpt::maps::CPointsMap::compute3DDistanceToMesh(), nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::computeInitialDistances(), mrpt::math::confidenceIntervals(), mrpt::math::TSegment3D::contains(), mrpt::math::TSegment2D::contains(), mrpt::hwdrivers::CIbeoLuxETH::convertToCartesian(), mrpt::vision::CFeature::descriptorORBDistanceTo(), mrpt::math::TSegment3D::distance(), mrpt::math::distance(), mrpt::vision::CFeatureLines::extractLines(), mrpt::poses::CPoseInterpolatorBase< 3 >::filter(), find_chessboard_corners_multiple(), mrpt::containers::find_in_vector(), mrpt::obs::CRawlog::findObservationsByClassInRange(), mrpt::obs::CObservationRotatingScan::fromVelodyne(), getHeight(), mrpt::graphslam::deciders::CICPCriteriaERD< GRAPH_T >::getNearbyNodesOf(), mrpt::graphslam::optimizers::CLevMarqGSO< GRAPH_T >::getNearbyNodesOf(), mrpt::poses::CPoseInterpolatorBase< 3 >::getPreviousPoseWithMinDistance(), mrpt::math::CBinaryRelation< T, U, UIsObject >::getRelationFrom(), mrpt::math::CBinaryRelation< T, U, UIsObject >::getRelationTo(), mrpt::math::CBinaryRelation< T, U, UIsObject >::getRelationValue(), mrpt::math::CBinaryRelation< T, U, UIsObject >::insertElement(), mrpt::math::CBinaryRelation< T, U, UIsObject >::insertElements(), mrpt::maps::CLandmarksMap::internal_computeObservationLikelihood(), mrpt::math::intersect(), mrpt::math::TSegment3D::length(), mrpt::math::TSegment2D::length(), mrpt::opengl::CPolyhedron::TPolyhedronEdge::length(), mrpt::slam::PF_implementation< mrpt::math::TPose3D, CMonteCarloLocalization3D, mrpt::bayes::particle_storage_mode::VALUE >::PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal(), mrpt::math::CBinaryRelation< T, U, UIsObject >::removeElement(), mrpt::math::CBinaryRelation< T, U, UIsObject >::removeElements(), mrpt::math::removeRepVertices(), mrpt::math::removeUnusedVertices(), mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration(), nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::searchLevel(), mrpt::math::CBinaryRelation< T, U, UIsObject >::setRelationValue(), mrpt::math::TSegment2D::signedDistance(), mrpt::math::splitInConvexComponents(), mrpt::math::TLine3D::TLine3D(), and velodyne_scan_to_pointcloud().
Gets the distance between two points in a 3D space.
Definition at line 1814 of file geometry.cpp.
References mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Gets the distance between two lines in a 2D space.
Definition at line 1838 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TLine2D::distance(), and geometryEpsilon.
Gets the distance between two lines in a 3D space.
Definition at line 1854 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::crossProduct3D(), mrpt::math::TLine3D::director, mrpt::math::TPlane::distance(), mrpt::math::TLine3D::distance(), geometryEpsilon, mrpt::math::getAngle(), and mrpt::math::TLine3D::pBase.
Gets the distance between two planes.
It will be zero if the planes are not parallel.
Definition at line 1870 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::TPlane::distance(), geometryEpsilon, and mrpt::math::getAngle().
double mrpt::math::distance | ( | const TPolygon2D & | p1, |
const TPolygon2D & | p2 | ||
) |
Gets the distance between two polygons in a 2D space.
double mrpt::math::distance | ( | const TPolygon2D & | p1, |
const TSegment2D & | s2 | ||
) |
Gets the distance between a polygon and a segment in a 2D space.
|
inline |
Gets the distance between a segment and a polygon in a 2D space.
Definition at line 560 of file geometry.h.
double mrpt::math::distance | ( | const TPolygon2D & | p1, |
const TLine2D & | l2 | ||
) |
Gets the distance between a polygon and a line in a 2D space.
|
inline |
Definition at line 566 of file geometry.h.
References mrpt::math::distance().
double mrpt::math::distance | ( | const TPolygon3D & | p1, |
const TPolygon3D & | p2 | ||
) |
Gets the distance between two polygons in a 3D space.
double mrpt::math::distance | ( | const TPolygon3D & | p1, |
const TSegment3D & | s2 | ||
) |
Gets the distance between a polygon and a segment in a 3D space.
|
inline |
Gets the distance between a segment and a polygon in a 3D space.
Definition at line 575 of file geometry.h.
double mrpt::math::distance | ( | const TPolygon3D & | p1, |
const TLine3D & | l2 | ||
) |
Gets the distance between a polygon and a line in a 3D space.
|
inline |
Gets the distance between a line and a polygon in a 3D space.
Definition at line 582 of file geometry.h.
References mrpt::math::distance().
double mrpt::math::distance | ( | const TPolygon3D & | po, |
const TPlane & | pl | ||
) |
Gets the distance between a polygon and a plane.
|
inline |
Gets the distance between a plane and a polygon.
Definition at line 589 of file geometry.h.
References mrpt::math::distance().
T mrpt::math::distanceBetweenPoints | ( | const T | x1, |
const T | y1, | ||
const T | x2, | ||
const T | y2 | ||
) |
Returns the distance between 2 points in 2D.
Definition at line 902 of file geometry.h.
Referenced by mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), and mrpt::tfest::se2_l2_robust().
T mrpt::math::distanceBetweenPoints | ( | const T | x1, |
const T | y1, | ||
const T | z1, | ||
const T | x2, | ||
const T | y2, | ||
const T | z2 | ||
) |
Returns the distance between 2 points in 3D.
Definition at line 909 of file geometry.h.
double mrpt::math::distancePointToPolygon2D | ( | double | px, |
double | py, | ||
unsigned int | polyEdges, | ||
const double * | poly_xs, | ||
const double * | poly_ys | ||
) |
Returns the closest distance of a given 2D point to a polygon, or "0" if the point is INTO the polygon or its perimeter.
Definition at line 264 of file geometry.cpp.
References mrpt::math::minimumDistanceFromPointToSegment(), and mrpt::math::pointIntoPolygon2D().
T mrpt::math::distanceSqrBetweenPoints | ( | const T | x1, |
const T | y1, | ||
const T | x2, | ||
const T | y2 | ||
) |
Returns the square distance between 2 points in 2D.
Definition at line 917 of file geometry.h.
References mrpt::square().
T mrpt::math::distanceSqrBetweenPoints | ( | const T | x1, |
const T | y1, | ||
const T | z1, | ||
const T | x2, | ||
const T | y2, | ||
const T | z2 | ||
) |
Returns the square distance between 2 points in 3D.
Definition at line 924 of file geometry.h.
CMatrixDouble33 mrpt::math::generateAxisBaseFromDirection | ( | double | dx, |
double | dy, | ||
double | dz | ||
) |
Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of them ("X") NOTE: Make sure of passing all floats or doubles and that the template of the receiving matrix is of the same type!
If is the input vector, then this function returns a matrix such as:
And the three normal vectors are computed as:
If (dx!=0 or dy!=0):
otherwise (the direction vector is vertical):
And finally, the third vector is the cross product of the others:
(JLB @ 18-SEP-2007)
Definition at line 2502 of file geometry.cpp.
References mrpt::math::MatrixBase< Scalar, Derived >::col(), mrpt::math::crossProduct3D(), MRPT_END, MRPT_START, mrpt::square(), and THROW_EXCEPTION.
Referenced by mrpt::maps::CBeacon::generateRingSOG(), and mrpt::maps::CLandmarksMap::loadSiftFeaturesFromImageObservation().
CMatrixDouble44 mrpt::math::generateAxisBaseFromDirectionAndAxis | ( | const mrpt::math::TVector3D & | vec, |
uint8_t | coord | ||
) |
Creates a homogeneus matrix (4x4) such that the coordinate given (0 for x, 1 for y, 2 for z) corresponds to the provided vector.
[in] | vec | must be a unitary vector |
Definition at line 1993 of file geometry.cpp.
References geometryEpsilon, and mrpt::math::MatrixVectorBase< Scalar, Derived >::setZero().
Referenced by mrpt::math::TPlane::getAsPose3D(), mrpt::math::TPlane::getAsPose3DForcingOrigin(), and mrpt::opengl::CArrow::onUpdateBuffers_Triangles().
Computes the angle between two planes.
Definition at line 846 of file geometry.cpp.
References mrpt::math::TPlane::coefs, geometryEpsilon, and M_PI.
Referenced by mrpt::math::TPlane::contains(), mrpt::math::TPlane::distance(), mrpt::math::distance(), mrpt::math::getAngle(), and TEST().
Computes the angle between a plane and a 3D line or segment (implicit constructor will be used if passing a segment instead of a line).
Definition at line 863 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::TLine3D::director, geometryEpsilon, M_PI, and mrpt::sign().
Computes the angle between a 3D line or segment and a plane (implicit constructor will be used if passing a segment instead of a line).
Definition at line 194 of file geometry.h.
References mrpt::math::getAngle().
Computes the accute relative angle (range: [-PI/2,PI/2]) between two lines.
Definition at line 880 of file geometry.cpp.
References mrpt::math::TLine3D::director, geometryEpsilon, and M_PI.
Computes the relative angle (range: [-PI,PI]) of line 2 wrt line 1.
Definition at line 897 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, and mrpt::math::wrapToPi().
Gets the bisector of two lines or segments (implicit constructor will be used if necessary)
Definition at line 2432 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, geometryEpsilon, mrpt::math::TObject2D::getPoint(), intersect(), mrpt::square(), mrpt::math::TLine2D::unitarize(), mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
Referenced by mrpt::math::getAngleBisector().
Gets the bisector of two lines or segments (implicit constructor will be used if necessary)
std::logic_error | if the lines do not fit in a single plane. |
Definition at line 2470 of file geometry.cpp.
References mrpt::math::getAngleBisector(), mrpt::math::TPlane::getAsPose3D(), and mrpt::math::project3D().
void mrpt::math::getPrismBounds | ( | const std::vector< TPoint3D > & | poly, |
TPoint3D & | pMin, | ||
TPoint3D & | pMax | ||
) |
Gets the prism bounds of a 3D polygon or set of 3D points.
Definition at line 1934 of file geometry.cpp.
References mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Referenced by mrpt::math::TPolygon3D::contains(), getMinAndMaxBounds(), and mrpt::math::intersect().
void mrpt::math::getRectangleBounds | ( | const std::vector< TPoint2D > & | poly, |
TPoint2D & | pMin, | ||
TPoint2D & | pMax | ||
) |
Gets the rectangular bounds of a 2D polygon or set of 2D points.
Definition at line 1822 of file geometry.cpp.
References mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
Using eigenvalues, gets the best fitting line for a set of 2D points.
Returns an estimation of the error.
Definition at line 2022 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::covariancesAndMean(), and mrpt::math::MatrixBase< Scalar, Derived >::eig_symmetric().
Using eigenvalues, gets the best fitting line for a set of 3D points.
Returns an estimation of the error.
Definition at line 2045 of file geometry.cpp.
References mrpt::math::covariancesAndMean(), mrpt::math::TLine3D::director, mrpt::math::MatrixBase< Scalar, Derived >::eig_symmetric(), and mrpt::math::TLine3D::pBase.
Using eigenvalues, gets the best fitting plane for a set of 3D points.
Returns an estimation of the error.
Definition at line 2065 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::covariancesAndMean(), mrpt::math::MatrixBase< Scalar, Derived >::eig_symmetric(), and geometryEpsilon.
Referenced by mrpt::detectors::CFaceDetection::checkIfFacePlane(), mrpt::math::conformAPlane(), mrpt::math::TPolygon3D::getBestFittingPlane(), and getPlanes().
void mrpt::math::getSegmentBisector | ( | const TSegment2D & | sgm, |
TLine2D & | bis | ||
) |
Gets the bisector of a 2D segment.
Definition at line 2410 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TSegment2D::getCenter(), mrpt::math::TSegment2D::point1, mrpt::math::TSegment2D::point2, mrpt::math::TLine2D::unitarize(), mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
void mrpt::math::getSegmentBisector | ( | const TSegment3D & | sgm, |
TPlane & | bis | ||
) |
Gets the bisector of a 3D segment.
Definition at line 2420 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::TSegment3D::getCenter(), mrpt::math::TSegment3D::point1, mrpt::math::TSegment3D::point2, mrpt::math::TPlane::unitarize(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
bool mrpt::math::intersect | ( | const TSegment3D & | s1, |
const TSegment3D & | s2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between two 3D segments.
Possible outcomes:
Definition at line 617 of file geometry.cpp.
References mrpt::math::TSegment3D::contains(), mrpt::math::TObject3D::getPoint(), intersect(), intersectInCommonLine(), and mrpt::math::TObject3D::isPoint().
Referenced by mrpt::opengl::CPolyhedron::getIntersection(), getPlanesIntersection(), mrpt::math::intersect(), mrpt::maps::CHeightGridMap2D_Base::intersectLine3D(), and TEST().
bool mrpt::math::intersect | ( | const TSegment3D & | s1, |
const TPlane & | p2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between a 3D segment and a plane.
Possible outcomes:
Definition at line 639 of file geometry.cpp.
References mrpt::math::TSegment3D::contains(), mrpt::math::TObject3D::getPoint(), intersect(), and mrpt::math::TObject3D::isLine().
bool mrpt::math::intersect | ( | const TSegment3D & | s1, |
const TLine3D & | r2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between a 3D segment and a 3D line.
Possible outcomes:
Definition at line 658 of file geometry.cpp.
References mrpt::math::TSegment3D::contains(), mrpt::math::TObject3D::getPoint(), intersect(), and mrpt::math::TObject3D::isLine().
|
inline |
Gets the intersection between a plane and a 3D segment.
Possible outcomes:
Definition at line 71 of file geometry.h.
References mrpt::math::intersect().
Gets the intersection between two planes.
Possible outcomes:
Definition at line 677 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::crossProduct3D(), mrpt::math::TLine3D::director, geometryEpsilon, mrpt::math::TLine3D::pBase, and mrpt::math::TLine3D::unitarize().
Gets the intersection between a plane and a 3D line.
Possible outcomes:
Definition at line 721 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::TLine3D::director, mrpt::math::TPlane::evaluatePoint(), geometryEpsilon, mrpt::math::TLine3D::pBase, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
|
inline |
Gets the intersection between a 3D line and a 3D segment.
Possible outcomes:
Definition at line 102 of file geometry.h.
References mrpt::math::intersect().
Gets the intersection between a 3D line and a plane.
Possible outcomes:
Definition at line 115 of file geometry.h.
References mrpt::math::intersect().
Gets the intersection between two 3D lines.
Possible outcomes:
Definition at line 753 of file geometry.cpp.
References mrpt::math::TLine3D::contains(), mrpt::math::TLine3D::director, geometryEpsilon, and mrpt::math::TLine3D::pBase.
Gets the intersection between two 2D lines.
Possible outcomes:
Definition at line 790 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, geometryEpsilon, mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
bool mrpt::math::intersect | ( | const TLine2D & | r1, |
const TSegment2D & | s2, | ||
TObject2D & | obj | ||
) |
Gets the intersection between a 2D line and a 2D segment.
Possible outcomes:
Definition at line 817 of file geometry.cpp.
References mrpt::math::TSegment2D::contains(), mrpt::math::TObject2D::getPoint(), intersect(), and mrpt::math::TObject2D::isLine().
|
inline |
Gets the intersection between a 2D line and a 2D segment.
Possible outcomes:
Definition at line 160 of file geometry.h.
References mrpt::math::intersect().
bool mrpt::math::intersect | ( | const TSegment2D & | s1, |
const TSegment2D & | s2, | ||
TObject2D & | obj | ||
) |
Gets the intersection between two 2D segments.
Possible outcomes:
Definition at line 832 of file geometry.cpp.
References mrpt::math::TSegment2D::contains(), mrpt::math::TObject2D::getPoint(), intersect(), intersectInCommonLine(), and mrpt::math::TObject2D::isLine().
bool mrpt::math::intersect | ( | const TPolygon2D & | p1, |
const TSegment2D & | s2, | ||
TObject2D & | obj | ||
) |
Gets the intersection between a 2D polygon and a 2D segment.
Definition at line 1221 of file geometry.cpp.
References mrpt::math::TSegment2D::contains(), mrpt::math::TObject2D::getPoint(), mrpt::math::TObject2D::getSegment(), intersect(), and intersectInCommonLine().
bool mrpt::math::intersect | ( | const TPolygon2D & | p1, |
const TLine2D & | r2, | ||
TObject2D & | obj | ||
) |
Gets the intersection between a 2D polygon and a 2D line.
Definition at line 1234 of file geometry.cpp.
References geometryEpsilon, mrpt::math::TLine2D::getAsPose2D(), mrpt::math::project2D(), and mrpt::sign().
bool mrpt::math::intersect | ( | const TPolygon2D & | p1, |
const TPolygon2D & | p2, | ||
TObject2D & | obj | ||
) |
Gets the intersection between two 2D polygons.
Definition at line 1381 of file geometry.cpp.
References mrpt::math::CSparseMatrixTemplate< T >::cols(), fromObject(), getSegmentsWithLine(), intersect(), mrpt::math::CSparseMatrixTemplate< T >::rows(), and THROW_EXCEPTION.
|
inline |
Gets the intersection between a 2D segment and a 2D polygon.
Definition at line 441 of file geometry.h.
|
inline |
Gets the intersection between a 2D line and a 2D polygon.
Definition at line 447 of file geometry.h.
References mrpt::math::intersect().
bool mrpt::math::intersect | ( | const TPolygon3D & | p1, |
const TSegment3D & | s2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between a 3D polygon and a 3D segment.
Definition at line 1429 of file geometry.cpp.
References mrpt::math::TPolygon2D::contains(), mrpt::math::TPose3D::fromHomogeneousMatrix(), mrpt::math::TPlane::getAsPose3DForcingOrigin(), mrpt::math::TPose3D::getInverseHomogeneousMatrix(), mrpt::math::TPolygon3D::getPlane(), mrpt::math::TObject3D::getPoint(), mrpt::math::TObject3D::getSegment(), intersect(), and mrpt::math::project3D().
bool mrpt::math::intersect | ( | const TPolygon3D & | p1, |
const TLine3D & | r2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between a 3D polygon and a 3D line.
Definition at line 1455 of file geometry.cpp.
References mrpt::math::TPolygon2D::contains(), mrpt::math::TPose3D::fromHomogeneousMatrix(), mrpt::math::TPlane::getAsPose3DForcingOrigin(), mrpt::math::TPose3D::getInverseHomogeneousMatrix(), mrpt::math::TPolygon3D::getPlane(), mrpt::math::TObject3D::getPoint(), intersect(), mrpt::math::TObject3D::isLine(), and mrpt::math::project3D().
bool mrpt::math::intersect | ( | const TPolygon3D & | p1, |
const TPlane & | p2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between a 3D polygon and a plane.
Definition at line 1480 of file geometry.cpp.
References mrpt::math::TObject3D::getLine(), mrpt::math::TPolygon3D::getPlane(), intersect(), and mrpt::math::TObject3D::isPlane().
bool mrpt::math::intersect | ( | const TPolygon3D & | p1, |
const TPolygon3D & | p2, | ||
TObject3D & | obj | ||
) |
Gets the intersection between two 3D polygons.
Definition at line 1539 of file geometry.cpp.
References compatibleBounds(), mrpt::math::TPolygon3D::getPlane(), mrpt::math::getPrismBounds(), and intersectAux().
|
inline |
Gets the intersection between a 3D segment and a 3D polygon.
Definition at line 462 of file geometry.h.
|
inline |
Gets the intersection between a 3D line and a 3D polygon.
Definition at line 468 of file geometry.h.
References mrpt::math::intersect().
|
inline |
Gets the intersection between a plane and a 3D polygon.
Definition at line 473 of file geometry.h.
References mrpt::math::intersect().
size_t mrpt::math::intersect | ( | const std::vector< TPolygon3D > & | v1, |
const std::vector< TPolygon3D > & | v2, | ||
CSparseMatrixTemplate< TObject3D > & | objs | ||
) |
Gets the intersection between two sets of 3D polygons.
The intersection is returned as an sparse matrix with each pair of polygons' intersections, and the return value is the amount of intersections found.
Definition at line 1579 of file geometry.cpp.
References mrpt::math::CSparseMatrixTemplate< T >::clear(), compatibleBounds(), getMinAndMaxBounds(), mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements(), getPlanes(), intersectAux(), and mrpt::math::CSparseMatrixTemplate< T >::resize().
size_t mrpt::math::intersect | ( | const std::vector< TPolygon3D > & | v1, |
const std::vector< TPolygon3D > & | v2, | ||
std::vector< TObject3D > & | objs | ||
) |
Gets the intersection between two sets of 3D polygons.
The intersection is returned as a vector with every intersection found, and the return value is the amount of intersections found.
Definition at line 1603 of file geometry.cpp.
References compatibleBounds(), getMinAndMaxBounds(), getPlanes(), and intersectAux().
size_t mrpt::math::intersect | ( | const std::vector< T > & | v1, |
const std::vector< U > & | v2, | ||
CSparseMatrixTemplate< O > & | objs | ||
) |
Gets the intersection between vectors of geometric objects and returns it in a sparse matrix of either TObject2D or TObject3D.
Definition at line 501 of file geometry.h.
References mrpt::math::CSparseMatrixTemplate< T >::clear(), mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements(), mrpt::math::intersect(), and mrpt::math::CSparseMatrixTemplate< T >::resize().
size_t mrpt::math::intersect | ( | const std::vector< T > & | v1, |
const std::vector< U > & | v2, | ||
std::vector< O > | objs | ||
) |
Gets the intersection between any pair of 2D objects.
Definition at line 1637 of file geometry.cpp.
References mrpt::math::TPolygon2D::contains(), mrpt::math::TSegment2D::contains(), mrpt::math::TLine2D::contains(), mrpt::math::distance(), geometryEpsilon, mrpt::math::TObject2D::getLine(), mrpt::math::TObject2D::getPoint(), mrpt::math::TObject2D::getPolygon(), mrpt::math::TObject2D::getSegment(), and intersect().
Gets the intersection between any pair of 3D objects.
Definition at line 1709 of file geometry.cpp.
References mrpt::math::TPolygon3D::contains(), mrpt::math::TPlane::contains(), mrpt::math::TSegment3D::contains(), mrpt::math::TLine3D::contains(), mrpt::math::distance(), geometryEpsilon, mrpt::math::TObject3D::getLine(), mrpt::math::TObject3D::getPlane(), mrpt::math::TObject3D::getPoint(), mrpt::math::TObject3D::getPolygon(), mrpt::math::TObject3D::getSegment(), and intersect().
bool mrpt::math::minDistBetweenLines | ( | double | p1_x, |
double | p1_y, | ||
double | p1_z, | ||
double | p2_x, | ||
double | p2_y, | ||
double | p2_z, | ||
double | p3_x, | ||
double | p3_y, | ||
double | p3_z, | ||
double | p4_x, | ||
double | p4_y, | ||
double | p4_z, | ||
double & | x, | ||
double & | y, | ||
double & | z, | ||
double & | dist | ||
) |
Calculates the minimum distance between a pair of lines.
The lines are given by:
Definition at line 298 of file geometry.cpp.
References mrpt::square().
double mrpt::math::minimumDistanceFromPointToSegment | ( | const double | Px, |
const double | Py, | ||
const double | x1, | ||
const double | y1, | ||
const double | x2, | ||
const double | y2, | ||
T & | out_x, | ||
T & | out_y | ||
) |
Computes the closest point from a given point to a segment, and returns that minimum distance.
Definition at line 934 of file geometry.h.
References mrpt::square().
Referenced by mrpt::math::distancePointToPolygon2D(), and mrpt::nav::CHolonomicND::evaluateGaps().
bool mrpt::math::pointIntoPolygon2D | ( | double | px, |
double | py, | ||
unsigned int | polyEdges, | ||
const double * | poly_xs, | ||
const double * | poly_ys | ||
) |
Returns true if the 2D point (px,py) falls INTO the given polygon.
Definition at line 233 of file geometry.cpp.
Referenced by mrpt::math::distancePointToPolygon2D().
bool mrpt::math::pointIntoQuadrangle | ( | T | x, |
T | y, | ||
T | v1x, | ||
T | v1y, | ||
T | v2x, | ||
T | v2y, | ||
T | v3x, | ||
T | v3y, | ||
T | v4x, | ||
T | v4y | ||
) |
Specialized method to check whether a point (x,y) falls into a quadrangle.
Definition at line 970 of file geometry.h.
void mrpt::math::project2D | ( | const TPoint2D & | point, |
const TPose2D & | newXpose, | ||
TPoint2D & | newPoint | ||
) |
Uses the given pose 2D to project a point into a new base.
Definition at line 1152 of file geometry.cpp.
References mrpt::math::TPose2D::composePoint().
Referenced by mrpt::math::intersect(), and mrpt::math::project2D().
|
inline |
Uses the given pose 2D to project a segment into a new base.
Definition at line 373 of file geometry.h.
Uses the given pose 2D to project a line into a new base.
Definition at line 1158 of file geometry.cpp.
References mrpt::math::TLine2D::coefs, mrpt::math::TPose2D::phi, mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.
void mrpt::math::project2D | ( | const TPolygon2D & | polygon, |
const TPose2D & | newXpose, | ||
TPolygon2D & | newPolygon | ||
) |
Uses the given pose 2D to project a polygon into a new base.
Definition at line 1170 of file geometry.cpp.
void mrpt::math::project2D | ( | const TObject2D & | object, |
const TPose2D & | newXpose, | ||
TObject2D & | newObject | ||
) |
Uses the given pose 2D to project any 2D object into a new base.
Definition at line 1179 of file geometry.cpp.
References mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_SEGMENT, mrpt::math::TObject2D::getLine(), mrpt::math::TObject2D::getPoint(), mrpt::math::TObject2D::getPolygon(), mrpt::math::TObject2D::getSegment(), mrpt::math::TObject2D::getType(), and mrpt::math::project2D().
void mrpt::math::project2D | ( | const T & | obj, |
const TLine2D & | newXLine, | ||
T & | newObj | ||
) |
Projects any 2D object into the line's base, using its inverse pose.
If the object is exactly inside the line, this projection will zero its Y coordinate.
CPOSE2D | set to TPose2D |
Definition at line 395 of file geometry.h.
References mrpt::math::TLine2D::getAsPose2D(), and mrpt::math::project2D().
void mrpt::math::project2D | ( | const T & | obj, |
const TLine2D & | newXLine, | ||
const TPoint2D & | newOrigin, | ||
T & | newObj | ||
) |
Projects any 2D object into the line's base, using its inverse pose and forcing the position of the new coordinate origin.
If the object is exactly inside the line, this projection will zero its Y coordinate.
CPOSE2D | set to TPose2D |
Definition at line 408 of file geometry.h.
References mrpt::math::TLine2D::getAsPose2DForcingOrigin(), and mrpt::math::project2D().
void mrpt::math::project2D | ( | const std::vector< T > & | objs, |
const TPose2D & | newXpose, | ||
std::vector< T > & | newObjs | ||
) |
Projects a set of 2D objects into the line's base.
Definition at line 418 of file geometry.h.
|
inline |
Uses the given pose 3D to project a point into a new base.
Definition at line 300 of file geometry.h.
Referenced by mrpt::math::TPolygon3D::contains(), mrpt::math::TPolygon3D::distance(), mrpt::math::getAngleBisector(), mrpt::math::intersect(), intersect(), intersectInCommonPlane(), FUnprojectPolygon2D::operator()(), mrpt::math::project3D(), and mrpt::math::splitInConvexComponents().
|
inline |
Uses the given pose 3D to project a segment into a new base.
Definition at line 307 of file geometry.h.
References mrpt::math::TPose3D::composePoint().
void mrpt::math::project3D | ( | const TLine3D & | line, |
const mrpt::math::TPose3D & | newXYpose, | ||
TLine3D & | newLine | ||
) |
Uses the given pose 3D to project a line into a new base.
Definition at line 1052 of file geometry.cpp.
References mrpt::math::TPose3D::composePoint(), mrpt::math::TLine3D::director, mrpt::math::TPose3D::getHomogeneousMatrix(), mrpt::math::TLine3D::pBase, and mrpt::math::TLine3D::unitarize().
void mrpt::math::project3D | ( | const TPlane & | plane, |
const mrpt::math::TPose3D & | newXYpose, | ||
TPlane & | newPlane | ||
) |
Uses the given pose 3D to project a plane into a new base.
Definition at line 1067 of file geometry.cpp.
References mrpt::math::TPlane::coefs, mrpt::math::TPlane::evaluatePoint(), mrpt::math::TPose3D::getHomogeneousMatrix(), mrpt::math::TPose3D::getInverseHomogeneousMatrix(), and mrpt::math::TPlane::unitarize().
void mrpt::math::project3D | ( | const TPolygon3D & | polygon, |
const mrpt::math::TPose3D & | newXYpose, | ||
TPolygon3D & | newPolygon | ||
) |
Uses the given pose 3D to project a polygon into a new base.
Definition at line 1093 of file geometry.cpp.
References mrpt::math::project3D().
void mrpt::math::project3D | ( | const TObject3D & | object, |
const mrpt::math::TPose3D & | newXYPose, | ||
TObject3D & | newObject | ||
) |
Uses the given pose 3D to project any 3D object into a new base.
Definition at line 1102 of file geometry.cpp.
References mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::GEOMETRIC_TYPE_PLANE, mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_SEGMENT, and mrpt::math::project3D().
void mrpt::math::project3D | ( | const T & | obj, |
const TPlane & | newXYPlane, | ||
T & | newObj | ||
) |
Projects any 3D object into the plane's base, using its inverse pose.
If the object is exactly inside the plane, this projection will zero its Z coordinates
Definition at line 336 of file geometry.h.
References mrpt::math::TPlane::getAsPose3D(), and mrpt::math::project3D().
void mrpt::math::project3D | ( | const T & | obj, |
const TPlane & | newXYPlane, | ||
const TPoint3D & | newOrigin, | ||
T & | newObj | ||
) |
Projects any 3D object into the plane's base, using its inverse pose and forcing the position of the new coordinates origin.
If the object is exactly inside the plane, this projection will zero its Z coordinates
Definition at line 347 of file geometry.h.
References mrpt::math::TPlane::getAsPose3D(), and mrpt::math::project3D().
void mrpt::math::project3D | ( | const std::vector< T > & | objs, |
const mrpt::math::TPose3D & | newXYpose, | ||
std::vector< T > & | newObjs | ||
) |
Projects a set of 3D objects into the plane's base.
Definition at line 359 of file geometry.h.
bool mrpt::math::RectanglesIntersection | ( | double | R1_x_min, |
double | R1_x_max, | ||
double | R1_y_min, | ||
double | R1_y_max, | ||
double | R2_x_min, | ||
double | R2_x_max, | ||
double | R2_y_min, | ||
double | R2_y_max, | ||
double | R2_pose_x, | ||
double | R2_pose_y, | ||
double | R2_pose_phi | ||
) |
Returns whether two rotated rectangles intersect.
The first rectangle is not rotated and given by (R1_x_min,R1_x_max)-(R1_y_min,R1_y_max). The second rectangle is given is a similar way, but it is internally rotated according to the given coordinates translation (R2_pose_x,R2_pose_y,R2_pose_phi(radians)), relative to the coordinates system of rectangle 1.
Definition at line 367 of file geometry.cpp.
References mrpt::math::CPolygon::AddVertex(), mrpt::math::CPolygon::PointIntoPolygon(), and mrpt::math::SegmentsIntersection().
Referenced by mrpt::hmtslam::CHierarchicalMapMHPartition::computeOverlapProbabilityBetweenNodes(), and TEST().
bool mrpt::math::SegmentsIntersection | ( | const double | x1, |
const double | y1, | ||
const double | x2, | ||
const double | y2, | ||
const double | x3, | ||
const double | y3, | ||
const double | x4, | ||
const double | y4, | ||
double & | ix, | ||
double & | iy | ||
) |
Returns the intersection point, and if it exists, between two segments.
Definition at line 120 of file geometry.cpp.
Referenced by mrpt::math::RectanglesIntersection(), and mrpt::math::SegmentsIntersection().
bool mrpt::math::SegmentsIntersection | ( | const double | x1, |
const double | y1, | ||
const double | x2, | ||
const double | y2, | ||
const double | x3, | ||
const double | y3, | ||
const double | x4, | ||
const double | y4, | ||
float & | ix, | ||
float & | iy | ||
) |
Returns the intersection point, and if it exists, between two segments.
Definition at line 218 of file geometry.cpp.
References mrpt::d2f(), and mrpt::math::SegmentsIntersection().
|
inline |
Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array:
.
Definition at line 802 of file geometry.h.
References ASSERT_.
Referenced by TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 818 of file geometry.h.
|
inline |
Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array:
.
Definition at line 836 of file geometry.h.
References ASSERT_.
Referenced by jacob_dA_eps_D_p_deps(), jacob_deps_D_p_deps(), and mrpt::math::vectorsAreParallel2D().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 852 of file geometry.h.
void mrpt::math::slerp | ( | const CQuaternion< T > & | q0, |
const CQuaternion< T > & | q1, | ||
const double | t, | ||
CQuaternion< T > & | q | ||
) |
SLERP interpolation between two quaternions.
[in] | q0 | The quaternion for t=0 |
[in] | q1 | The quaternion for t=1 |
[in] | t | A "time" parameter, in the range [0,1]. |
[out] | q | The output, interpolated quaternion. |
T | The type of the quaternion (e.g. float, double). |
std::exception | Only in Debug, if t is not in the valid range. |
Definition at line 32 of file slerp.h.
References ASSERTDEB_, and mrpt::square().
Referenced by mrpt::math::slerp(), mrpt::math::slerp_ypr(), and TEST().
SLERP interpolation between two 6D poses - like mrpt::math::slerp for quaternions, but interpolates the [X,Y,Z] coordinates as well.
[in] | p0 | The pose for t=0 |
[in] | p1 | The pose for t=1 |
[in] | t | A "time" parameter, in the range [0,1]. |
[out] | p | The output, interpolated pose. |
std::exception | Only in Debug, if t is not in the valid range. |
Definition at line 17 of file slerp.cpp.
References mrpt::math::TPose3D::getAsQuaternion(), mrpt::math::TPose3D::pitch, mrpt::math::TPose3D::roll, mrpt::math::CQuaternion< T >::rpy(), mrpt::math::slerp(), mrpt::math::TPose3D::x, mrpt::math::TPose3D::y, mrpt::math::TPose3D::yaw, and mrpt::math::TPose3D::z.
void mrpt::math::slerp_ypr | ( | const mrpt::math::TPose3D & | q0, |
const mrpt::math::TPose3D & | q1, | ||
const double | t, | ||
mrpt::math::TPose3D & | p | ||
) |
Definition at line 32 of file slerp.cpp.
References mrpt::math::TPose3D::getAsQuaternion(), mrpt::math::TPose3D::pitch, mrpt::math::TPose3D::roll, mrpt::math::CQuaternion< T >::rpy(), mrpt::math::slerp(), mrpt::math::UNINITIALIZED_QUATERNION, mrpt::math::TPose3D::x, mrpt::math::TPose3D::y, mrpt::math::TPose3D::yaw, and mrpt::math::TPose3D::z.
Referenced by mrpt::poses::CPoseInterpolatorBase< 3 >::impl_interpolation(), and TEST().
bool mrpt::math::splitInConvexComponents | ( | const TPolygon2D & | poly, |
std::vector< TPolygon2D > & | components | ||
) |
Splits a 2D polygon into convex components.
Definition at line 2291 of file geometry.cpp.
References mrpt::math::distance(), geometryEpsilon, mrpt::math::TObject2D::getPoint(), intersect(), mrpt::math::TPolygon2D::removeRedundantVertices(), TSegmentWithLine::segment, and mrpt::sign().
Referenced by mrpt::opengl::CPolyhedron::makeConvexPolygons(), and mrpt::math::splitInConvexComponents().
bool mrpt::math::splitInConvexComponents | ( | const TPolygon3D & | poly, |
std::vector< TPolygon3D > & | components | ||
) |
Splits a 3D polygon into convex components.
std::logic_error | if the polygon can't be fit into a plane. |
Definition at line 2386 of file geometry.cpp.
References mrpt::math::TPlane::getAsPose3DForcingOrigin(), mrpt::math::TPolygon3D::getPlane(), mrpt::math::project3D(), and mrpt::math::splitInConvexComponents().
bool mrpt::math::traceRay | ( | const std::vector< TPolygonWithPlane > & | vec, |
const mrpt::math::TPose3D & | pose, | ||
double & | dist | ||
) |
Fast ray tracing method using polygons' properties.
Definition at line 2484 of file geometry.cpp.
References mrpt::math::createFromPoseX(), intersect(), and mrpt::math::TLine3D::unitarize().
Referenced by mrpt::opengl::CTexturedPlane::traceRay(), mrpt::opengl::CSetOfTriangles::traceRay(), mrpt::opengl::CMesh::traceRay(), and mrpt::opengl::CPolyhedron::traceRay().
|
inline |
Fast ray tracing method using polygons' properties.
Definition at line 743 of file geometry.h.
|
inline |
Returns true if two 2D vectors are parallel.
The arguments may be points, arrays, etc.
Definition at line 864 of file geometry.h.
References mrpt::math::skew_symmetric3_neg(), and mrpt::math::UNINITIALIZED_MATRIX.
|
inline |
Returns true if two 3D vectors are parallel.
The arguments may be points, arrays, etc.
Definition at line 874 of file geometry.h.
References mrpt::math::getEpsilon().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |