Main MRPT website > C++ reference
MRPT logo
Public Member Functions

mrpt::math::CPolygon Class Reference


Detailed Description

A wrapper of a TPolygon2D class, implementing CSerializable.

Definition at line 44 of file CPolygon.h.

#include <mrpt/math/CPolygon.h>

Inheritance diagram for mrpt::math::CPolygon:
Inheritance graph
[legend]

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:

RTTI stuff

typedef CPolygonPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CPolygon
static mrpt::utils::TRuntimeClassId classCPolygon
static const
mrpt::utils::TRuntimeClassId
classinfo
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CPolygonPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 47 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

static const mrpt::utils::TRuntimeClassId* mrpt::math::CPolygon::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::utils::CSerializable.

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

Add a new vertex to polygon:

Definition at line 60 of file CPolygon.h.

References push_back().

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

Clear the polygon, erasing all vertexs.

Definition at line 84 of file CPolygon.h.

static CPolygonPtr mrpt::math::CPolygon::Create ( ) [static]
static mrpt::utils::CObject* mrpt::math::CPolygon::CreateObject ( ) [static]
virtual mrpt::utils::CObject* mrpt::math::CPolygon::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

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

Get all vertices at once.

virtual const mrpt::utils::TRuntimeClassId* mrpt::math::CPolygon::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

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 ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

Set all vertices at once.

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 ( 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

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().


Member Data Documentation

Definition at line 47 of file CPolygon.h.

Definition at line 47 of file CPolygon.h.

Definition at line 47 of file CPolygon.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011