1234567891011121314151617181920212223242526272829303132 |
- #include "Figure.h"
- #include <vector>
- #include <string>
- using namespace std;
- class Polygon: public Figure
- {
- private:
- vector<Point> points;
- void init(vector<struct Point> init_points);
- void sort_points();
- public:
- template <typename T>
- Polygon(vector<T> init_points)
- {
- for(int i = 0; i < init_points.lenght; i+=2)
- struct Point p;
- p.x = init_points[i];
- p.y = init_points[i+1];
- points.push_back(p);
- }
- Polygon(vector<struct Point> init_points);
- Polygon(string file_path);
- double calc_area();
- double calc_perimiter();
- void name();
- };
|