Fixed warning

This commit is contained in:
enricoturri1966 2021-05-24 14:42:57 +02:00
parent 429eda5666
commit 9d216104e0

View File

@ -203,19 +203,19 @@ namespace Slic3r { namespace Geometry {
static bool sort_points(const Point& a, const Point& b) static bool sort_points(const Point& a, const Point& b)
{ {
return (a(0) < b(0)) || (a(0) == b(0) && a(1) < b(1)); return (a.x() < b.x()) || (a.x() == b.x() && a.y() < b.y());
} }
static bool sort_pointfs(const Vec3d& a, const Vec3d& b) static bool sort_pointfs(const Vec3d& a, const Vec3d& b)
{ {
return (a(0) < b(0)) || (a(0) == b(0) && a(1) < b(1)); return (a.x() < b.x()) || (a.x() == b.x() && a.y() < b.y());
} }
// This implementation is based on Andrew's monotone chain 2D convex hull algorithm // This implementation is based on Andrew's monotone chain 2D convex hull algorithm
Polygon convex_hull(Points pts) Polygon convex_hull(Points pts)
{ {
std::sort(pts.begin(), pts.end(), [](const Point& a, const Point& b) { return a(0) < b(0) || (a(0) == b(0) && a(1) < b(1)); }); std::sort(pts.begin(), pts.end(), sort_points);
pts.erase(std::unique(pts.begin(), pts.end(), [](const Point& a, const Point& b) { return a(0) == b(0) && a(1) == b(1); }), pts.end()); pts.erase(std::unique(pts.begin(), pts.end(), [](const Point& a, const Point& b) { return a.x() == b.x() && a.y() == b.y(); }), pts.end());
Polygon hull; Polygon hull;
int n = (int)pts.size(); int n = (int)pts.size();