MathGeoLib icon indicating copy to clipboard operation
MathGeoLib copied to clipboard

Polyhedron::ConvexHull segmentation faults

Open mwlow opened this issue 9 years ago • 2 comments

Calling Polyhedron::ConvexHull will sometimes cause a segmentation fault. I've attached a sample point cloud for which this will occur, as well as a rendering of the points. points.txt img

mwlow avatar Jul 16 '16 14:07 mwlow

Centering/scaling the points seems to prevent the fault.

mwlow avatar Jul 16 '16 14:07 mwlow

The convex hull computation algorithm has been a pain point for some time, getting it numerically robust is proving to be very difficult. (Although I am not fully convinced if the root issues are all atm explained by numerical stability, or if there are some outright bugs as well)

When computing convex hulls, I generally have done the same trick, and computed the AABB of the points, and recentered it to origin, and scaled it to [-128, 128] range.

One thing I notice about these points is that they contain duplicates. For example the point (-136.898, 353.329, 308.042) occurs twice. It is possible that the algorithm does not resolve identical points well, but degenerates to an infinite recursion loop or something like that, which causes it to segfault when it runs out of stack space. In these kind of scenarios, filtering out duplicates might be one thing to try as well.

juj avatar Jul 19 '16 09:07 juj