CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.87k stars 1.38k forks source link

Assertion fail on 3D boolean operation #353

Closed taus closed 9 years ago

taus commented 9 years ago

When trying to perform 3D boolean operations on Nef polyhedra i get the assertion fail

CGAL error: assertion violation!
Expression : G.mark(v1,0)==G.mark(v2,0)&& G.mark(v1,1)==G.mark(v2,1)
File       : ./CGAL/include/CGAL/Nef_S2/SM_overlayer.h 
Line       : 287

I have insured that the meshes are closed, valid and triangular. I have created a minimal example here: https://github.com/taus/CGALMinimal to demonstrate the error. The example includes a simple mesh creator and uses this to create two overlapping boxes. It then converts them to Nef polyhedra and tries to do a union. I have tried this in both CGAL 4.6.7 and the 4.7 beta.

sloriot commented 9 years ago

The meshes are self-intersecting and thus don't have an inside/outside which explains why the nef code was not able to correctly mark the volume. screenshot from 2015-09-22 10 03 40

sloriot commented 9 years ago

See this function

taus commented 9 years ago

Thank you. I got the impression from the documentation that the requirement for succesfully converting a polyhedron to nef was the "is_closed" predicate. I got it working now though. As a small heads up, in the header file polygon_mesh_processing.h, the inclusion of the file polygon_soup_to_polygon_mesh is missing the Polygon_mesh_processing/ directory.

sloriot commented 9 years ago

The first requirement is that the input is a valid polyhedral surface :) Thanks for the bug-report. I just fixed it.