MRPT  1.9.9
mrpt::math::TSegment2D Struct Reference

Detailed Description

2D segment, consisting of two points.

See also
TSegment3D,TLine2D,TPolygon2D,TPoint2D

Definition at line 20 of file TSegment2D.h.

#include <mrpt/math/TSegment2D.h>

Public Member Functions

double length () const
 Segment length. More...
 
double distance (const TPoint2D &point) const
 Distance to point. More...
 
double signedDistance (const TPoint2D &point) const
 Distance with sign to point (sign indicates which side the point is). More...
 
bool contains (const TPoint2D &point) const
 Check whether a point is inside a segment. More...
 
TPoint2Doperator[] (size_t i)
 Access to points using operator[0-1]. More...
 
constexpr const TPoint2Doperator[] (size_t i) const
 Access to points using operator[0-1]. More...
 
void generate3DObject (TSegment3D &s) const
 Project into 3D space, setting the z to 0. More...
 
void getCenter (TPoint2D &p) const
 Segment's central point. More...
 
 TSegment2D (const TPoint2D &p1, const TPoint2D &p2)
 Constructor from both points. More...
 
 TSegment2D ()=default
 Fast default constructor. More...
 
 TSegment2D (const TSegment3D &s)
 Explicit constructor from 3D object, discarding the z. More...
 
bool operator< (const TSegment2D &s) const
 

Public Attributes

TPoint2D point1
 Origin point. More...
 
TPoint2D point2
 Destiny point. More...
 

Constructor & Destructor Documentation

◆ TSegment2D() [1/3]

mrpt::math::TSegment2D::TSegment2D ( const TPoint2D p1,
const TPoint2D p2 
)
inline

Constructor from both points.

Definition at line 88 of file TSegment2D.h.

◆ TSegment2D() [2/3]

mrpt::math::TSegment2D::TSegment2D ( )
default

Fast default constructor.

Initializes to garbage.

◆ TSegment2D() [3/3]

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

Explicit constructor from 3D object, discarding the z.

Definition at line 625 of file TPoseOrPoint.cpp.

References point1, and point2.

Member Function Documentation

◆ contains()

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

Check whether a point is inside a segment.

Definition at line 616 of file TPoseOrPoint.cpp.

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

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

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

◆ distance()

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

Distance to point.

Definition at line 590 of file TPoseOrPoint.cpp.

References signedDistance().

Referenced by mrpt::nav::CHolonomicFullEval::evalSingleTarget(), mrpt::nav::CAbstractNavigator::performNavigationStepNavigating(), and mrpt::nav::CWaypointsNavigator::waypoints_navigationStep().

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

◆ generate3DObject()

void mrpt::math::TSegment2D::generate3DObject ( TSegment3D s) const

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

Definition at line 621 of file TPoseOrPoint.cpp.

◆ getCenter()

void mrpt::math::TSegment2D::getCenter ( TPoint2D p) const
inline

Segment's central point.

Definition at line 80 of file TSegment2D.h.

References point1, point2, mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

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

Here is the caller graph for this function:

◆ length()

double mrpt::math::TSegment2D::length ( ) const

Segment length.

Definition at line 589 of file TPoseOrPoint.cpp.

References mrpt::math::distance(), point1, and point2.

Referenced by signedDistance().

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

◆ operator<()

bool mrpt::math::TSegment2D::operator< ( const TSegment2D s) const

Definition at line 633 of file TPoseOrPoint.cpp.

References point1, and point2.

◆ operator[]() [1/2]

TPoint2D& mrpt::math::TSegment2D::operator[] ( size_t  i)
inline

Access to points using operator[0-1].

Definition at line 48 of file TSegment2D.h.

References point1, and point2.

◆ operator[]() [2/2]

constexpr const TPoint2D& mrpt::math::TSegment2D::operator[] ( size_t  i) const
inline

Access to points using operator[0-1].

Definition at line 61 of file TSegment2D.h.

References point1, and point2.

◆ signedDistance()

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

Distance with sign to point (sign indicates which side the point is).

Definition at line 594 of file TPoseOrPoint.cpp.

References mrpt::math::distance(), length(), min, point1, point2, mrpt::math::TLine2D::signedDistance(), and mrpt::square().

Referenced by distance().

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

Member Data Documentation

◆ point1

◆ point2




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019