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

Detailed Description

2D segment, consisting of two points.

See also
TSegment3D,TLine2D,TPolygon2D,TPoint2D

Definition at line 568 of file lightweight_geom_data.h.

#include <mrpt/math/lightweight_geom_data.h>

Public Member Functions

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

Public Attributes

TPoint2D point1
 Origin point.
 
TPoint2D point2
 Destiny point.
 

Constructor & Destructor Documentation

◆ TSegment2D() [1/3]

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

Constructor from both points.

Definition at line 612 of file lightweight_geom_data.h.

◆ TSegment2D() [2/3]

mrpt::math::TSegment2D::TSegment2D ( )
inline

Fast default constructor.

Initializes to garbage.

Definition at line 616 of file lightweight_geom_data.h.

◆ TSegment2D() [3/3]

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

Explicit constructor from 3D object, discarding the z.

Member Function Documentation

◆ contains()

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

Check whether a point is inside a segment.

◆ distance()

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

Distance to point.

◆ generate3DObject()

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

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

◆ getCenter()

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

Segment's central point.

Definition at line 605 of file lightweight_geom_data.h.

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

◆ length()

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

Segment length.

◆ operator<()

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

◆ operator[]() [1/2]

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

Access to points using operator[0-1].

Definition at line 595 of file lightweight_geom_data.h.

◆ operator[]() [2/2]

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

Access to points using operator[0-1].

Definition at line 597 of file lightweight_geom_data.h.

◆ signedDistance()

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

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

Member Data Documentation

◆ point1

TPoint2D mrpt::math::TSegment2D::point1

Origin point.

Definition at line 573 of file lightweight_geom_data.h.

Referenced by mrpt::math::operator!=(), mrpt::math::operator==(), and mrpt::math::project2D().

◆ point2

TPoint2D mrpt::math::TSegment2D::point2

Destiny point.

Definition at line 577 of file lightweight_geom_data.h.

Referenced by mrpt::math::operator!=(), mrpt::math::operator==(), and mrpt::math::project2D().




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 08:20:48 UTC 2023