42 TPolygon2D::push_back(
TPoint2D(x,y));
48 double GetVertex_x(
size_t i)
const {
ASSERT_(i<TPolygon2D::size());
return TPolygon2D::operator [](i).x; }
49 double GetVertex_y(
size_t i)
const {
ASSERT_(i<TPolygon2D::size());
return TPolygon2D::operator [](i).y; }
55 void setAllVertices(
const std::vector<double> &x,
const std::vector<double> &y );
65 void Clear() { TPolygon2D::clear(); }
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A wrapper of a TPolygon2D class, implementing CSerializable.
void setAllVertices(size_t nVertices, const float *xs, const float *ys)
Set all vertices at once.
bool PointIntoPolygon(double x, double y) const
Check if a point is inside the polygon:
size_t verticesCount() const
Returns the vertices count in the polygon:
CPolygon()
Constructor cx and cy are the "central" point coordinates (laser sensor location if applicable) This ...
void setAllVertices(size_t nVertices, const double *xs, const double *ys)
Set all vertices at once.
void getAllVertices(std::vector< double > &x, std::vector< double > &y) const
Get all vertices at once.
void setAllVertices(const std::vector< double > &x, const std::vector< double > &y)
Set all vertices at once.
void Clear()
Clear the polygon, erasing all vertexs.
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
2D polygon, inheriting from std::vector<TPoint2D>.
bool contains(const TPoint2D &point) const
Check whether a point is inside the polygon.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.