Skip to content

Commit

Permalink
Don't include holes in convex hull
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo committed Jan 11, 2024
1 parent 047edff commit 0265e74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ Polygons Polygons::approxConvexHull(int extra_outset)

void Polygons::makeConvex()
{
// early out if there is nothing to do
if (empty())
{
return;
}

// convex hulls cannot have holes, so remove all paths except the outerpath
this->paths.resize(1);

// Andrew’s Monotone Chain Convex Hull Algorithm
for (PolygonRef poly : *this)
{
Expand Down

1 comment on commit 0265e74

@rburema
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 0265e74 Previous: c2deb49 Ratio
SimplifyTestFixture/simplify_slot_noplugin 1.2408219839382426 ns/iter 0.9484019370731928 ns/iter 1.31

This comment was automatically generated by workflow using github-action-benchmark.

CC: @nallath @jellespijker @wawanbreton @casperlamboo @saumyaj3 @HellAholic

Please sign in to comment.