Main MRPT website > C++ reference for MRPT 1.5.7
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 595 of file lightweight_geom_data.h.

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

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

Constructor from both points.

Definition at line 639 of file lightweight_geom_data.h.

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

Fast default constructor.

Initializes to garbage.

Definition at line 643 of file lightweight_geom_data.h.

References mrpt::poses::operator<().

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

Explicit constructor from 3D object, discarding the z.

Definition at line 303 of file lightweight_geom_data.cpp.

References mrpt::math::TSegment3D::point1, and mrpt::math::TSegment3D::point2.

Member Function Documentation

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

Check whether a point is inside a segment.

Definition at line 297 of file lightweight_geom_data.cpp.

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

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

double mrpt::math::TSegment2D::distance ( const TPoint2D point) const
void mrpt::math::TSegment2D::generate3DObject ( TSegment3D s) const

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

Definition at line 300 of file lightweight_geom_data.cpp.

References mrpt::math::TSegment3D.

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

Segment's central point.

Definition at line 632 of file lightweight_geom_data.h.

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

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

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

Segment length.

Definition at line 274 of file lightweight_geom_data.cpp.

References mrpt::math::distance().

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

Definition at line 309 of file lightweight_geom_data.cpp.

References point1, and point2.

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

Access to points using operator[0-1].

Definition at line 622 of file lightweight_geom_data.h.

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

Access to points using operator[0-1].

Definition at line 624 of file lightweight_geom_data.h.

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

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

Definition at line 280 of file lightweight_geom_data.cpp.

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

Member Data Documentation

TPoint2D mrpt::math::TSegment2D::point1
TPoint2D mrpt::math::TSegment2D::point2



Page generated by Doxygen 1.8.11 for MRPT 1.5.7 Git: 2190203 Tue May 15 02:01:15 2018 +0200 at miƩ may 16 12:40:16 CEST 2018