-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi !
I experienced csgjs to get stuck in build trying to split one polygon against itself over and over because the coplanar test fails in splitPolygon() because of precision issues. I was able to enhance it by making epsilon larger. But what solved it for me was not trying to split the polygon against itself at all. So in csgjs_csgnode::build() I replaced
for (size_t i = 1; i < list.size(); i++)
me->plane.splitPolygon(list[i], me->polygons, me->polygons, list_front, list_back);
with
me->polygons.push_back(list[0]);
for (size_t i = 1; i < list.size(); i++)
me->plane.splitPolygon(list[i], me->polygons, me->polygons, list_front, list_back);
splitPolygons() would theoretically add the polygon list[0] to me->polygons if there weren't precision errors. So I just do this upfront and start with i = 1. I'm not sure if this breaks somethign else but it still looks good to me and I don't get these infinite loops.
jkuhlmann, tkslan and jgphilpott
Metadata
Metadata
Assignees
Labels
No labels