MRPT  1.9.9
mrpt::math::TLine2D Struct Reference

Detailed Description

2D line without bounds, represented by its equation $Ax+By+C=0$.

See also
TLine3D,TSegment2D,TPolygon2D,TPoint2D

Definition at line 19 of file TLine2D.h.

#include <mrpt/math/TLine2D.h>

Public Member Functions

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...
 
 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...
 
void getAsPose2D (TPose2D &outPose) const
 
void getAsPose2DForcingOrigin (const TPoint2D &origin, TPose2D &outPose) const
 

Public Attributes

std::array< double, 3 > coefs {{0, 0, 0}}
 Line coefficients, stored as an array: $\left[A,B,C\right]$. More...
 

Constructor & Destructor Documentation

◆ TLine2D() [1/5]

mrpt::math::TLine2D::TLine2D ( const TPoint2D p1,
const TPoint2D p2 
)

Constructor from two points, through which the line will pass.

Exceptions
logic_errorif both points are the same

Definition at line 786 of file TPoseOrPoint.cpp.

References coefs, mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

◆ TLine2D() [2/5]

mrpt::math::TLine2D::TLine2D ( const TSegment2D s)
explicit

Constructor from a segment.

Definition at line 793 of file TPoseOrPoint.cpp.

References coefs.

◆ TLine2D() [3/5]

mrpt::math::TLine2D::TLine2D ( )
default

Fast default constructor.

Initializes to garbage.

◆ TLine2D() [4/5]

constexpr mrpt::math::TLine2D::TLine2D ( double  A,
double  B,
double  C 
)
inline

Constructor from line's coefficients.

Definition at line 88 of file TLine2D.h.

◆ TLine2D() [5/5]

mrpt::math::TLine2D::TLine2D ( const TLine3D l)
explicit

Construction from 3D object, discarding the Z.

Exceptions
std::logic_errorif the line is normal to the XY plane.

Definition at line 800 of file TPoseOrPoint.cpp.

References coefs, mrpt::math::TLine3D::director, mrpt::math::getEpsilon(), mrpt::math::TLine3D::pBase, mrpt::math::TPoint3D_data::x, and mrpt::math::TPoint3D_data::y.

Here is the call graph for this function:

Member Function Documentation

◆ contains()

bool mrpt::math::TLine2D::contains ( const TPoint2D point) const

Check whether a point is inside the line.

Definition at line 730 of file TPoseOrPoint.cpp.

References distance(), and mrpt::math::getEpsilon().

Referenced by getAsPose2DForcingOrigin(), and mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance()

double mrpt::math::TLine2D::distance ( const TPoint2D point) const

Distance from a given point.

Definition at line 734 of file TPoseOrPoint.cpp.

References coefs, and evaluatePoint().

Referenced by contains(), mrpt::math::distance(), and mrpt::vision::matchFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluatePoint()

double mrpt::math::TLine2D::evaluatePoint ( const TPoint2D point) const

Evaluate point in the line's equation.

Definition at line 726 of file TPoseOrPoint.cpp.

References coefs, mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

Referenced by distance(), and signedDistance().

Here is the caller graph for this function:

◆ generate3DObject()

void mrpt::math::TLine2D::generate3DObject ( TLine3D l) const

Project into 3D space, setting the z to 0.

Definition at line 759 of file TPoseOrPoint.cpp.

◆ getAsPose2D()

void mrpt::math::TLine2D::getAsPose2D ( TPose2D outPose) const

Definition at line 760 of file TPoseOrPoint.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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAsPose2DForcingOrigin()

void mrpt::math::TLine2D::getAsPose2DForcingOrigin ( const TPoint2D origin,
TPose2D outPose 
) const

Definition at line 777 of file TPoseOrPoint.cpp.

References coefs, contains(), and mrpt::math::TPose2D::phi.

Referenced by mrpt::math::project2D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDirectorVector()

void mrpt::math::TLine2D::getDirectorVector ( double(&)  vector[2]) const

Get line's director vector.

Definition at line 754 of file TPoseOrPoint.cpp.

References coefs.

Referenced by getUnitaryDirectorVector().

Here is the caller graph for this function:

◆ getNormalVector()

void mrpt::math::TLine2D::getNormalVector ( double(&)  vector[2]) const

Get line's normal vector.

Definition at line 744 of file TPoseOrPoint.cpp.

References coefs.

Referenced by getUnitaryNormalVector().

Here is the caller graph for this function:

◆ getUnitaryDirectorVector()

void mrpt::math::TLine2D::getUnitaryDirectorVector ( double(&)  vector[2])
inline

Unitarize line and then get director vector.

Definition at line 63 of file TLine2D.h.

References getDirectorVector(), and unitarize().

Here is the call graph for this function:

◆ getUnitaryNormalVector()

void mrpt::math::TLine2D::getUnitaryNormalVector ( double(&)  vector[2])
inline

Get line's normal vector after unitarizing line.

Definition at line 51 of file TLine2D.h.

References getNormalVector(), and unitarize().

Here is the call graph for this function:

◆ signedDistance()

double mrpt::math::TLine2D::signedDistance ( const TPoint2D point) const

Distance with sign from a given point (sign indicates side).

Definition at line 739 of file TPoseOrPoint.cpp.

References coefs, and evaluatePoint().

Referenced by mrpt::math::TSegment2D::signedDistance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unitarize()

void mrpt::math::TLine2D::unitarize ( )

Unitarize line's normal vector.

Definition at line 749 of file TPoseOrPoint.cpp.

References coefs.

Referenced by mrpt::math::getAngleBisector(), mrpt::math::getSegmentBisector(), getUnitaryDirectorVector(), and getUnitaryNormalVector().

Here is the caller graph for this function:

Member Data Documentation

◆ coefs




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: abb8b1a1e Fri Oct 18 14:19:12 2019 +0200 at vie oct 18 14:20:13 CEST 2019