mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
Finished porting convex_hull() to XS and removed dependency on Math::ConvexHull::MonotoneChain
This commit is contained in:
@@ -9,6 +9,9 @@ sort_points (Point a, Point b)
|
||||
return (a.x < b.x) || (a.x == b.x && a.y < b.y);
|
||||
}
|
||||
|
||||
/* This implementation is based on Steffen Mueller's work for
|
||||
the Perl module Math::ConvexHull::MonotoneChain (available
|
||||
on CPAN under the GPL terms) */
|
||||
void
|
||||
convex_hull(Points points, Polygon &hull)
|
||||
{
|
||||
@@ -40,6 +43,10 @@ convex_hull(Points points, Polygon &hull)
|
||||
hull.points.push_back(*(out_hull[i]));
|
||||
}
|
||||
|
||||
// not sure why this happens randomly
|
||||
if (hull.points.front().coincides_with(hull.points.back()))
|
||||
hull.points.pop_back();
|
||||
|
||||
free(out_hull);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user