-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Description
Hi, i noticed that, in rare cases, jarvis_march fails to produce a valid hull. Instead, it keeps looping around the supplied point list. I have a really hard time understanding the problem (shouldn't be co-planarity, since it works in other cases). Anyway, i applied a patch that works for me. Not sure a PR is worth it, here my addition (which is admittedly not really mathematic-ish):
local checked = 1
while(visited[q]) do
checked = checked + 1
q = points[q + 1] and q + 1 or 1
if (checked == #points) then
return hull
end
end
.. which goes right at line 40, before the loop. This at least prevents the algo to loop over infinitely, while still supplying a valid hull (at least, it looks to me in a test case with ~ 200 procedurally generated point clouds). I'm bothering to write here because it looks @Yonaba's Lua implementation is the landing page for people with convex-hull needs :)
Metadata
Metadata
Assignees
Labels
No labels