dimforge / ncollide

2 and 3-dimensional collision detection library in Rust.
https://ncollide.org
Apache License 2.0
921 stars 107 forks source link

HACD resulting in missing or unwanted solid objects #346

Open bellwether-softworks opened 4 years ago

bellwether-softworks commented 4 years ago

I'm working with concave 3D shapes (created using projected 2d polylines), and am attempting to use HACD to decompose these into convex shapes. When doing so, the resulting output seems to produce "holes", or in some cases, unexpected solid shapes. I've played with the error and min_components parameters and admittedly don't have a good grasp on how they should affect the process, but in so doing only seem to make things worse rather than better.

Also, I'm aware of #338, but would eventually like to use HACD to represent profiling operations (e.g. angled notches) in simple shapes.

I have two illustrations of this process not working as expected, implemented as examples using kiss3d for rendering:

complex-orthogonal

The desired 3d shape in this example would be a projection of the following 2d shape as represented in desmos: image

What I see when I attempt to perform HACD: image

rounded-contour

This is a more complex example, and demonstrates behavior where the solid region seems to be inverted. In desmos: image

...and after applying HACD (green sphere in image represents origin): image