CGAL::intersection failed with "Holes of the PWH intersect amongst themselves or with outer boundary" error
Issue Details
The execution of the CGAL::intersection method failed with the following error message:
CGAL warning: check violation!
Expression : holes_disjoint
File : /.../cgal/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h
Line : 791
Explanation: Holes of the PWH intersect amongst themselves or with outer boundary
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: is_valid_unknown_polygon(p, t)
File: /.../cgal/include/CGAL/General_polygon_set_on_surface_2.h
Line: 39
Before execution, I've checked that the polygons were valid and correctly oriented (outer boundary - counterclockwise, holes - clockwise). And I'm using CGAL::Exact_predicates_exact_constructions_kernel. The assertion is triggered inside the intersection call.
Source Code
- https://gist.github.com/ruslo/7e722a5fdd323925a07955d20a3148da
Environment
- Operating system: Linux, Ubuntu 22.04.3, 64 bits
- Compiler: GCC 11.4.0
- Release or debug mode: Debug
- Specific flags used (if any): CGAL_USE_GMPXX=1
- CGAL version: 5.5, 5.6, 8718201f
- Boost version: 1.74
I confirm that there is a problem.
It is caused by the polyline traits, which is now used by default for regularized Boolean operations.
If you replace the statement on line 62 with the statement below, the program works fine.
CGAL::intersection(a, b_c, std::back_inserter(result), CGAL::Tag_false());
BW, there is another problem with the CGAL::draw(pwh) function when the b_c polygon with holes is passed as an argument.
If you replace the statement on line 62 with the statement below, the program works fine
Indeed, worked for me, thanks for the workaround :ok_hand: