MRPT logo

mrpt::math::TPolygon2D Class Reference

2D polygon, inheriting from std::vector<TPoint2D>. More...

#include <mrpt/math/lightweight_geom_data.h>

Inheritance diagram for mrpt::math::TPolygon2D:

mrpt::math::CPolygon

List of all members.

Public Member Functions

double distance (const TPoint2D &point) const
 Distance to a point.
bool contains (const TPoint2D &point) const
 Check whether a point is inside the polygon.
void getAsSegmentList (std::vector< TSegment2D > &v) const
 Gets as set of segments, instead of points.
void generate3DObject (TPolygon3D &p) const
 Projects into 3D space, zeroing the z.
void getCenter (TPoint2D &p) const
 Polygon's central point.
bool isConvex () const
 Checks whether is convex.
void removeRepeatedVertices ()
 Erase repeated vertices.
void removeRedundantVertices ()
 Erase every redundant vertex from the polygon, saving space.
void getPlotData (std::vector< double > &x, std::vector< double > &y) const
 Gets plot data, ready to use on a 2D plot.
 TPolygon2D ()
 Default constructor.
 TPolygon2D (size_t N)
 Constructor for a given number of vertices, intializing them as garbage.
 TPolygon2D (const std::vector< TPoint2D > &v)
 Implicit constructor from a vector of 2D points.
 TPolygon2D (const TPolygon3D &p)
 Constructor from a 3D object.

Static Public Member Functions

static void createRegularPolygon (size_t numEdges, double radius, TPolygon2D &poly)
 Static method to create a regular polygon, given its size and radius.
static void createRegularPolygon (size_t numEdges, double radius, TPolygon2D &poly, const mrpt::poses::CPose2D &pose)
 Static method to create a regular polygon from its size and radius.


Detailed Description

2D polygon, inheriting from std::vector<TPoint2D>.

See also:
TPolygon3D,TSegment2D,TLine2D,TPoint2D, CPolygon

Definition at line 860 of file lightweight_geom_data.h.


Constructor & Destructor Documentation

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

Default constructor.

Definition at line 904 of file lightweight_geom_data.h.

mrpt::math::TPolygon2D::TPolygon2D ( size_t  N  )  [inline, explicit]

Constructor for a given number of vertices, intializing them as garbage.

Definition at line 908 of file lightweight_geom_data.h.

mrpt::math::TPolygon2D::TPolygon2D ( const std::vector< TPoint2D > &  v  )  [inline]

Implicit constructor from a vector of 2D points.

Definition at line 912 of file lightweight_geom_data.h.

mrpt::math::TPolygon2D::TPolygon2D ( const TPolygon3D p  )  [explicit]

Constructor from a 3D object.


Member Function Documentation

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

Check whether a point is inside the polygon.

Referenced by mrpt::math::CPolygon::PointIntoPolygon().

static void mrpt::math::TPolygon2D::createRegularPolygon ( size_t  numEdges,
double  radius,
TPolygon2D poly,
const mrpt::poses::CPose2D pose 
) [inline, static]

Static method to create a regular polygon from its size and radius.

The center will correspond to the given pose.

Exceptions:
std::logic_error if radius is near zero or the number of edges is less than three.

static void mrpt::math::TPolygon2D::createRegularPolygon ( size_t  numEdges,
double  radius,
TPolygon2D poly 
) [static]

Static method to create a regular polygon, given its size and radius.

Exceptions:
std::logic_error if radius is near zero or the number of edges is less than three.

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

Distance to a point.

void mrpt::math::TPolygon2D::generate3DObject ( TPolygon3D p  )  const

Projects into 3D space, zeroing the z.

void mrpt::math::TPolygon2D::getAsSegmentList ( std::vector< TSegment2D > &  v  )  const

Gets as set of segments, instead of points.

void mrpt::math::TPolygon2D::getCenter ( TPoint2D p  )  const

Polygon's central point.

void mrpt::math::TPolygon2D::getPlotData ( std::vector< double > &  x,
std::vector< double > &  y 
) const

Gets plot data, ready to use on a 2D plot.

See also:
mrpt::gui::CDisplayWindowPlots

bool mrpt::math::TPolygon2D::isConvex (  )  const

Checks whether is convex.

void mrpt::math::TPolygon2D::removeRedundantVertices (  ) 

Erase every redundant vertex from the polygon, saving space.

See also:
removeRepeatedVertices

void mrpt::math::TPolygon2D::removeRepeatedVertices (  ) 

Erase repeated vertices.

See also:
removeRedundantVertices




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:27:43 EDT 2009