15 int number()
const {
return static_cast<int>(_v.size()); }
20 std::vector<Point2D> _v;
41 return "Polygon of with "+std::to_string(
number())+
" vertices";
48 void append(
const Point2D& a) { _v.push_back(a); _peri=-1.0F; _area=-1.0F; }
54 int number()
const {
return static_cast<int>(_v.size()); }
69 float area()
const override;
79 std::vector<Point2D> _v;
Class containing a point in 2D.
bool operator<(const Polygon_old &rhs) const
void append(const Point2D &a)
Contains the description of a polygon, now with mutable. The traverse is stored.
bool operator<(const Polygon &rhs) const
Less operator regarding the perimeter.
int number() const
Number of vertices in polygon.
Polygon(int n)
Constructs a regular polygon with vertices on the unit circle.
float perimeter() const
Computes the perimeter of the closed polygon.
void append(const Point2D &a)
Adds a vertex to the end of the polygon traverse.
float area() const override
Computes the area of the closed polygon.
Polygon(Polygon const &)=default
std::string classname() const override