Go to the documentation of this file. 1 #ifndef POLYGON_H_INCLUDED
2 #define POLYGON_H_INCLUDED
23 Point2D(
float x,
float y) : _x(x), _y(y) {}
27 float GetX()
const {
return _x;}
31 float GetY()
const {
return _y;}
55 return std::sqrt( std::pow(a.
GetX()-b.
GetX(),2) + std::pow(a.
GetY()-b.
GetY(),2) );
65 int number()
const {
return _v.size(); }
70 std::vector<Point2D> _v;
97 int number()
const {
return _v.size(); }
114 std::vector<Point2D> _v;
123 #endif // POLYGON_H_INCLUDED
float GetY() const
Getter.
void append(const Point2D &a)
Adds a vertex to the end of the polygon traverse.
Class containing a point in 2D.
float GetX() const
Getter.
void append(const Point2D &a)
bool operator<(const Polygon &rhs) const
Less operator regarding the perimeter.
Point2D(float x, float y)
Constructor.
Polygon(int n)
Constructs a regular polygon with vertices on the unit circle.
std::ostream & operator<<(std::ostream &s, const Point2D &rhs)
Output operator for class Point2D.
Contains the description of a polygon, now with mutable. The traverse is stored.
bool operator<(const Polygon_old &rhs) const
int number() const
Number of vertices in polygon.
float dist(const Point2D &a, const Point2D &b)
Calculates the Euclidian distance between two points in 2D.
float perimeter() const
Computes the perimeter of the closed polygon.
Point2D()
Constructor without parameters. Defines the point to the origin (0.0).