123456789101112131415161718192021222324 |
- #include "Polygon.h"
- #include <iostream>
- #include <algorithm>
- Polygon::init(vector<struct Point> init_points)
- {
- points = init_points;
- }
- Polygon::Polygon(vector<struct Point> init_points)
- {
- init(init_points);
- }
- void Polygon::sort_points()
- {
- return std::sort(points.begin(), points.end(), [](struct Point lhs, struct Point rhs) {return l2(lhs.x, lhs.y, 0.0, 0.0) < l2(rhs.x, rhs.y, 0.0, 0.0); });
- }
- double Polygon::calc_perimiter()
- {
- sort_points();
- std::cout << points << std::endl;
- }
|