MRPT
2.0.4
|
2D line without bounds, represented by its equation .
#include <mrpt/math/TLine2D.h>
Public Member Functions | |
TLine2D (const TPoint2D &p1, const TPoint2D &p2) | |
Constructor from two points, through which the line will pass. More... | |
TLine2D (const TSegment2D &s) | |
Constructor from a segment. More... | |
TLine2D ()=default | |
Fast default constructor. More... | |
constexpr | TLine2D (double A, double B, double C) |
Constructor from line's coefficients. More... | |
TLine2D (const TLine3D &l) | |
Construction from 3D object, discarding the Z. More... | |
double | evaluatePoint (const TPoint2D &point) const |
Evaluate point in the line's equation. More... | |
bool | contains (const TPoint2D &point) const |
Check whether a point is inside the line. More... | |
double | distance (const TPoint2D &point) const |
Distance from a given point. More... | |
double | signedDistance (const TPoint2D &point) const |
Distance with sign from a given point (sign indicates side). More... | |
void | getNormalVector (double(&vector)[2]) const |
Get line's normal vector. More... | |
void | unitarize () |
Unitarize line's normal vector. More... | |
void | getUnitaryNormalVector (double(&vector)[2]) |
Get line's normal vector after unitarizing line. More... | |
void | getDirectorVector (double(&vector)[2]) const |
Get line's director vector. More... | |
void | getUnitaryDirectorVector (double(&vector)[2]) |
Unitarize line and then get director vector. More... | |
void | generate3DObject (TLine3D &l) const |
Project into 3D space, setting the z to 0. More... | |
void | getAsPose2D (TPose2D &outPose) const |
void | getAsPose2DForcingOrigin (const TPoint2D &origin, TPose2D &outPose) const |
Static Public Member Functions | |
static TLine2D | FromCoefficientsABC (double A, double B, double C) |
Static constructor from Ax+By+C=0 coefficients. More... | |
static TLine2D | FromTwoPoints (const TPoint2D &p1, const TPoint2D &p2) |
Static constructor from two points. More... | |
Public Attributes | |
std::array< double, 3 > | coefs {{0, 0, 0}} |
Line coefficients, stored as an array: . More... | |
Constructor from two points, through which the line will pass.
logic_error | if both points are the same |
Definition at line 95 of file TLine2D.cpp.
References coefs, mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
|
explicit |
Constructor from a segment.
Definition at line 102 of file TLine2D.cpp.
References coefs, mrpt::math::TSegment2D::point1, mrpt::math::TSegment2D::point2, mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
|
default |
Fast default constructor.
Initializes to undefined values.
Referenced by FromCoefficientsABC(), and FromTwoPoints().
|
inline |
|
explicit |
Construction from 3D object, discarding the Z.
std::logic_error | if the line is normal to the XY plane. |
Definition at line 109 of file TLine2D.cpp.
References coefs, mrpt::math::TLine3D::director, mrpt::math::getEpsilon(), mrpt::math::TLine3D::pBase, mrpt::math::TPoint3D_data< T >::x, and mrpt::math::TPoint3D_data< T >::y.
bool TLine2D::contains | ( | const TPoint2D & | point | ) | const |
Check whether a point is inside the line.
Definition at line 39 of file TLine2D.cpp.
References distance(), and mrpt::math::getEpsilon().
Referenced by getAsPose2DForcingOrigin(), and mrpt::math::intersect().
double TLine2D::distance | ( | const TPoint2D & | point | ) | const |
Distance from a given point.
Definition at line 43 of file TLine2D.cpp.
References coefs, and evaluatePoint().
Referenced by contains(), mrpt::math::distance(), and mrpt::vision::matchFeatures().
double TLine2D::evaluatePoint | ( | const TPoint2D & | point | ) | const |
Evaluate point in the line's equation.
Definition at line 35 of file TLine2D.cpp.
References coefs, mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.
Referenced by distance(), and signedDistance().
|
static |
Static constructor from Ax+By+C=0 coefficients.
Definition at line 25 of file TLine2D.cpp.
References TLine2D().
Static constructor from two points.
Definition at line 30 of file TLine2D.cpp.
References TLine2D().
void TLine2D::generate3DObject | ( | TLine3D & | l | ) | const |
Project into 3D space, setting the z to 0.
Definition at line 68 of file TLine2D.cpp.
void TLine2D::getAsPose2D | ( | TPose2D & | outPose | ) | const |
Definition at line 69 of file TLine2D.cpp.
References coefs, mrpt::math::getEpsilon(), mrpt::math::TPose2D::phi, mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.
Referenced by mrpt::math::intersect(), and mrpt::math::project2D().
Definition at line 86 of file TLine2D.cpp.
References coefs, contains(), and mrpt::math::TPose2D::phi.
Referenced by mrpt::math::project2D().
void TLine2D::getDirectorVector | ( | double(&) | vector[2] | ) | const |
Get line's director vector.
Definition at line 63 of file TLine2D.cpp.
References coefs.
Referenced by getUnitaryDirectorVector().
void TLine2D::getNormalVector | ( | double(&) | vector[2] | ) | const |
Get line's normal vector.
Definition at line 53 of file TLine2D.cpp.
References coefs.
Referenced by getUnitaryNormalVector().
|
inline |
Unitarize line and then get director vector.
Definition at line 92 of file TLine2D.h.
References getDirectorVector(), and unitarize().
|
inline |
Get line's normal vector after unitarizing line.
Definition at line 80 of file TLine2D.h.
References getNormalVector(), and unitarize().
double TLine2D::signedDistance | ( | const TPoint2D & | point | ) | const |
Distance with sign from a given point (sign indicates side).
Definition at line 48 of file TLine2D.cpp.
References coefs, and evaluatePoint().
Referenced by mrpt::math::TSegment2D::signedDistance().
void TLine2D::unitarize | ( | ) |
Unitarize line's normal vector.
Definition at line 58 of file TLine2D.cpp.
References coefs.
Referenced by mrpt::math::getAngleBisector(), mrpt::math::getSegmentBisector(), getUnitaryDirectorVector(), and getUnitaryNormalVector().
std::array<double, 3> mrpt::math::TLine2D::coefs {{0, 0, 0}} |
Line coefficients, stored as an array: .
Definition at line 52 of file TLine2D.h.
Referenced by mrpt::math::createFromPoseAndVector(), mrpt::math::createFromPoseX(), mrpt::math::createFromPoseY(), distance(), mrpt::math::distance(), evaluatePoint(), mrpt::math::getAngle(), mrpt::math::getAngleBisector(), getAsPose2D(), getAsPose2DForcingOrigin(), getDirectorVector(), getNormalVector(), mrpt::math::getRegressionLine(), mrpt::math::getSegmentBisector(), mrpt::math::intersect(), intersectInCommonLine(), mrpt::vision::matchFeatures(), mrpt::math::operator<<(), mrpt::math::operator>>(), mrpt::math::project2D(), mrpt::math::ransac2Dline_distance(), mrpt::math::ransac2Dline_fit(), signedDistance(), TLine2D(), mrpt::math::TLine3D::TLine3D(), and unitarize().
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 |