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 1155 of file lightweight_geom_data.h.

#include <mrpt/math/lightweight_geom_data.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 ()
 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

double coefs [3]
 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 719 of file lightweight_geom_data.cpp.

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

◆ TLine2D() [2/5]

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

Constructor from a segment.

Definition at line 726 of file lightweight_geom_data.cpp.

References coefs.

◆ TLine2D() [3/5]

mrpt::math::TLine2D::TLine2D ( )
inline

Fast default constructor.

Initializes to garbage.

Definition at line 1222 of file lightweight_geom_data.h.

◆ TLine2D() [4/5]

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

Constructor from line's coefficients.

Definition at line 1226 of file lightweight_geom_data.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 733 of file lightweight_geom_data.cpp.

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

Member Function Documentation

◆ contains()

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

Check whether a point is inside the line.

Definition at line 663 of file lightweight_geom_data.cpp.

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

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

◆ distance()

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

Distance from a given point.

Definition at line 667 of file lightweight_geom_data.cpp.

References coefs, and evaluatePoint().

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

◆ evaluatePoint()

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

Evaluate point in the line's equation.

Definition at line 659 of file lightweight_geom_data.cpp.

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

Referenced by distance(), mrpt::math::TPolygon2D::isConvex(), and signedDistance().

◆ generate3DObject()

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

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

Definition at line 692 of file lightweight_geom_data.cpp.

◆ getAsPose2D()

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

◆ getAsPose2DForcingOrigin()

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

Definition at line 710 of file lightweight_geom_data.cpp.

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

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

◆ getDirectorVector()

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

Get line's director vector.

Definition at line 687 of file lightweight_geom_data.cpp.

References coefs.

Referenced by getUnitaryDirectorVector().

◆ getNormalVector()

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

Get line's normal vector.

Definition at line 677 of file lightweight_geom_data.cpp.

References coefs.

Referenced by getUnitaryNormalVector().

◆ getUnitaryDirectorVector()

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

Unitarize line and then get director vector.

Definition at line 1201 of file lightweight_geom_data.h.

References getDirectorVector(), and unitarize().

◆ getUnitaryNormalVector()

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

Get line's normal vector after unitarizing line.

Definition at line 1189 of file lightweight_geom_data.h.

References getNormalVector(), and unitarize().

◆ signedDistance()

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

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

Definition at line 672 of file lightweight_geom_data.cpp.

References coefs, and evaluatePoint().

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

◆ unitarize()

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

Unitarize line's normal vector.

Definition at line 682 of file lightweight_geom_data.cpp.

References coefs.

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

Member Data Documentation

◆ coefs




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020