iDynTree::Polygon2D class

Class representing a 2D Polygon expressed in the 2D space.

Constructors, destructors, conversion operators

Polygon2D()
Default constructor: build an invalid polygon without any vertex.

Public functions

void setNrOfVertices(size_t size)
Set the number of vertices (the vertices can then be accessed with the operator()
auto getNrOfVertices() const -> size_t
Get the number of vertices in the Polygon.
auto isValid() const -> bool
Check if a polygon is valid.
auto operator()(const size_t idx) -> Vector2&
auto operator()(const size_t idx) const -> const Vector2&

Public variables

std::vector<Vector2> m_vertices

Function documentation

size_t iDynTree::Polygon2D::getNrOfVertices() const

Get the number of vertices in the Polygon.

Returns the number of vertices

bool iDynTree::Polygon2D::isValid() const

Check if a polygon is valid.

Returns true if is valid, false otherwise.

The condition for the validity of the polygon are: It has at least three points.