MRPT logo

mrpt::math::CPolygon Class Reference

A wrapper of a TPolygon2D class, implementing CSerializable. More...

#include <mrpt/math/CPolygon.h>

Inheritance diagram for mrpt::math::CPolygon:

mrpt::utils::CSerializable mrpt::math::TPolygon2D

List of all members.

Public Member Functions

 CPolygon ()
 Constructor cx and cy are the "central" point coordinates (laser sensor location if applicable) This parameters are NOT used in PointIntoPolygon, so they can be ignored.
void AddVertex (double x, double y)
 Add a new vertex to polygon:.
double GetVertex_x (size_t i) const
 Methods for accessing the vertexs:.
double GetVertex_y (size_t i) const
size_t verticesCount () const
 Returns the vertices count in the polygon:.
void setAllVertices (const std::vector< double > &x, const std::vector< double > &y)
 Set all vertices at once.
void setAllVertices (size_t nVertices, const double *xs, const double *ys)
 Set all vertices at once.
void setAllVertices (size_t nVertices, const float *xs, const float *ys)
 Set all vertices at once.
void getAllVertices (std::vector< double > &x, std::vector< double > &y) const
 Get all vertices at once.
void Clear ()
 Clear the polygon, erasing all vertexs.
bool PointIntoPolygon (double x, double y) const
 Check if a point is inside the polygon:.


Detailed Description

A wrapper of a TPolygon2D class, implementing CSerializable.

Definition at line 44 of file CPolygon.h.


Constructor & Destructor Documentation

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

Constructor cx and cy are the "central" point coordinates (laser sensor location if applicable) This parameters are NOT used in PointIntoPolygon, so they can be ignored.

See also:
PointIntoPolygon

Definition at line 55 of file CPolygon.h.


Member Function Documentation

void mrpt::math::CPolygon::AddVertex ( double  x,
double  y 
) [inline]

Add a new vertex to polygon:.

Definition at line 60 of file CPolygon.h.

void mrpt::math::CPolygon::Clear (  )  [inline]

Clear the polygon, erasing all vertexs.

Definition at line 84 of file CPolygon.h.

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

Get all vertices at once.

double mrpt::math::CPolygon::GetVertex_x ( size_t  i  )  const [inline]

Methods for accessing the vertexs:.

See also:
verticesCount

Definition at line 67 of file CPolygon.h.

References ASSERT_, and mrpt::math::size().

double mrpt::math::CPolygon::GetVertex_y ( size_t  i  )  const [inline]

Definition at line 68 of file CPolygon.h.

References ASSERT_, and mrpt::math::size().

bool mrpt::math::CPolygon::PointIntoPolygon ( double  x,
double  y 
) const [inline]

Check if a point is inside the polygon:.

Definition at line 88 of file CPolygon.h.

References mrpt::math::TPolygon2D::contains().

void mrpt::math::CPolygon::setAllVertices ( size_t  nVertices,
const float *  xs,
const float *  ys 
)

Set all vertices at once.

Please use the std::vector version whenever possible unless efficiency is really an issue

void mrpt::math::CPolygon::setAllVertices ( size_t  nVertices,
const double *  xs,
const double *  ys 
)

Set all vertices at once.

Please use the std::vector version whenever possible unless efficiency is really an issue

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

Set all vertices at once.

size_t mrpt::math::CPolygon::verticesCount (  )  const [inline]

Returns the vertices count in the polygon:.

Definition at line 71 of file CPolygon.h.

References mrpt::math::size().




Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 22:58:25 EDT 2009