cgal icon indicating copy to clipboard operation
cgal copied to clipboard

convex_decomposition_3 fails for on trivial concave Nef3 polyhedron

Open kintel opened this issue 1 year ago • 2 comments

Issue Details

Using the convex_decomposition_3 example at https://doc.cgal.org/latest/Convex_decomposition_3/Convex_decomposition_3_2list_of_convex_parts_8cpp-example.html, the decomposition fails for a relatively trivial concave Nef3 polyhedron:

$ ./decompose < issue.nef3
CGAL::Polyhedron_incremental_builder_3<HDS>::
add_vertex_to_facet(): vertex index 41 is out-of-range [0,15].
decomposition into 9 convex parts 

The error causes one of the decomposed volumes to be empty. It seems to be the large center cuboid that fails.

Screenshot 2024-07-25 at 14 49 52

Design was initially created using this OpenSCAD script:

difference() {
  cube([10,10,8], center=true);
  cube([8,8,10], center=true);
}
cube([12, 12, 4], center=true);

Source Code

https://doc.cgal.org/latest/Convex_decomposition_3/Convex_decomposition_3_2list_of_convex_parts_8cpp-example.html

issue2841.nef3.txt

Environment

  • Operating system: macOS 13.6 M1, but issue seems to be present across OSes
  • Compiler: clang15 (Xcode 15.2)
  • Release or debug mode: Release mode
  • CGAL version: 5.6.1 and 5.5 tested
  • Boost version: 1.81.0

kintel avatar Jul 25 '24 12:07 kintel

Any chance you'd have the input mesh as OFF ?

sloriot avatar Aug 26 '24 08:08 sloriot

OFF file (exported from OpenSCAD). It seems to exhibit the same issue: issue2841.off.txt

kintel avatar Aug 28 '24 02:08 kintel

https://github.com/CGAL/cgal/pull/8442 should fix the issue.

sloriot avatar Aug 29 '24 08:08 sloriot