Main MRPT website > C++ reference for MRPT 1.5.6
List of all members | Public Member Functions | Public Attributes

Detailed Description

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

See also
TLine3D,TSegment2D,TPolygon2D,TPoint2D

Definition at line 735 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...
 
void getAsPose2D (mrpt::poses::CPose2D &outPose) const
 Get a pose2D whose X axis corresponds to the line. More...
 
void getAsPose2DForcingOrigin (const TPoint2D &origin, mrpt::poses::CPose2D &outPose) const
 Get a pose2D whose X axis corresponds to the line, forcing the base point to one given. 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...
 
 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...
 

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 449 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 455 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 810 of file lightweight_geom_data.h.

◆ TLine2D() [4/5]

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

Constructor from line's coefficients.

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

References coefs, mrpt::math::TLine3D::director, mrpt::math::geometryEpsilon, 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 407 of file lightweight_geom_data.cpp.

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

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 410 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 404 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 428 of file lightweight_geom_data.cpp.

References mrpt::math::TLine3D.

◆ getAsPose2D()

void mrpt::math::TLine2D::getAsPose2D ( mrpt::poses::CPose2D outPose) const

◆ getAsPose2DForcingOrigin()

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

Get a pose2D whose X axis corresponds to the line, forcing the base point to one given.

Exceptions
logic_errorif the point is not inside the line.
See also
mrpt::poses::CPose2D.

Definition at line 443 of file lightweight_geom_data.cpp.

References coefs, contains(), and mrpt::poses::CPose2D::phi().

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

◆ getDirectorVector()

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

Get line's director vector.

Definition at line 424 of file lightweight_geom_data.cpp.

References coefs.

◆ getNormalVector()

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

Get line's normal vector.

Definition at line 416 of file lightweight_geom_data.cpp.

References coefs.

◆ getUnitaryDirectorVector()

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

Unitarize line and then get director vector.

Definition at line 779 of file lightweight_geom_data.h.

◆ getUnitaryNormalVector()

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

Get line's normal vector after unitarizing line.

Definition at line 768 of file lightweight_geom_data.h.

◆ signedDistance()

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

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

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

References coefs.

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

Member Data Documentation

◆ coefs

double mrpt::math::TLine2D::coefs[3]



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019