Main MRPT website > C++ reference
MRPT logo

mrpt::math::TSegment2D Struct Reference

2D segment, consisting of two points. More...

#include <mrpt/math/lightweight_geom_data.h>

Collaboration diagram for mrpt::math::TSegment2D:
Collaboration graph
[legend]

List of all members.

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)
 Unsafe point access using [] operator, intended for loops.
const TPoint2Doperator[] (size_t i) const
 Unsafe point access using [] operator, intended for loops.
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.

Detailed Description

2D segment, consisting of two points.

See also:
TSegment3D,TLine2D,TPolygon2D,TPoint2D

Definition at line 640 of file lightweight_geom_data.h.


Constructor & Destructor Documentation

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

Constructor from both points.

Definition at line 692 of file lightweight_geom_data.h.

mrpt::math::TSegment2D::TSegment2D (  )  [inline]

Fast default constructor.

Initializes to garbage.

Definition at line 696 of file lightweight_geom_data.h.

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

Explicit constructor from 3D object, discarding the z.


Member Function Documentation

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

Check whether a point is inside a segment.

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

Distance to point.

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

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

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

Segment's central point.

Definition at line 685 of file lightweight_geom_data.h.

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

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

Segment length.

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

Unsafe point access using [] operator, intended for loops.

Definition at line 675 of file lightweight_geom_data.h.

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

Unsafe point access using [] operator, intended for loops.

Definition at line 669 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).


Member Data Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010