mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Finished porting convex_hull() to XS and removed dependency on Math::ConvexHull::MonotoneChain
This commit is contained in:
parent
5309e3ef22
commit
de9d5403e8
5 changed files with 21 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue