Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am using CGAL for some geometric operations on polyhedrons. In particular I am using the Polyhedron_3 and Nef_polyhedron_3 with the following kernel etc.... :

#include "CGAL/Simple_cartesian.h" 
#include "CGAL/Polyhedron_3.h" 
#include "CGAL/Nef_polyhedron_3.h" 
#include "CGAL/Gmpz.h" 
#include "CGAL/Polyhedron_incremental_builder_3.h" 
#include "CGAL/IO/Polyhedron_iostream.h" 
namespace ARECGAL 
    typedef CGAL::Simple_cartesian<CGAL::Gmpz> Kernel; 
    typedef CGAL::Polyhedron_3<Kernel> Polyhedron; 
    typedef CGAL::Nef_polyhedron_3<Kernel> Nef_Polyhedron; 
    typedef Polyhedron::HalfedgeDS HalfedgeDS; 
    typedef Nef_Polyhedron::Vector_3  Vector_3; 
    typedef Nef_Polyhedron::Aff_transformation_3  Aff_transformation_3; 

And I am performing an intersection using this method:

Polyhedron intersection(Polyhedron & i_poly1,Polyhedron & i_poly2) 
         if (i_poly1.is_closed() && i_poly2.is_closed()) 
              Nef_Polyhedron NP1(i_poly1); 
              Nef_Polyhedron NP2(i_poly2); 
              Nef_Polyhedron NP = NP1 * NP2; 
              //useless code for the topic 
              throw Utils::ProcessControl::AREException(notClosedGeoErrorMsg, 
                                            __FUNCTION__, 
                                            notClosedGeoErrorValue); 
   catch (Utils::ProcessControl::AREException & exception) 
       throw exception; 

With the following inputs:

8 12 0 -2e+07 -2e+07 1.00006e+07 -2e+07 2e+07 1.00008e+07 2e+07 -2e+07 1.00001e+07 2e+07 2e+07 1.00005e+07 -2e+07 -2e+07 4e+07 -2e+07 2e+07 4e+07 2e+07 -2e+07 4e+07 2e+07 2e+07 4e+07 3 2 0 1 3 3 2 1 3 5 4 6 3 5 6 7 3 2 4 0 3 2 6 4 3 0 5 1 3 0 4 5 3 3 6 2 3 3 7 6 3 1 7 3 3 1 5 7 8 12 0 -2e+07 -2e+07 -1.99998e+07 -2e+07 2e+07 -1.99998e+07 2e+07 -2e+07 -1.99998e+07 2e+07 2e+07 -1.99998e+07 -2e+07 -2e+07 6.99999e+07 -2e+07 2e+07 6.99999e+07 2e+07 -2e+07 6.99999e+07 2e+07 2e+07 6.99999e+07 3 2 0 1 3 3 2 1 3 5 4 6 3 5 6 7 3 2 4 0 3 2 6 4 3 0 5 1 3 0 4 5 3 3 6 2 3 3 7 6 3 1 7 3 3 1 5 7

It crashes at the first Polyhedron to Nef_polyhedron conversion launching the following assertion (in debug mode):

 terminate called after throwing an instance of 'CGAL::Assertion_exception' 
 what():  CGAL ERROR: assertion violation! 
 Expr: h.has_on(p) 
 File: /home/giorgio/Scrivania/Librerie/CGAL-4.4/include/CGAL/Nef_3/SNC_intersection.h 
 Line: 377 

What's wrong?

Thank you, Giorgio

When I tried this on my end (unfortunately I have CGAL 4.3 and not 4.4), I didn't get any errors. At first I thought it was because of the kernel I used (wasn't paying too much attention and used exact predicates/exact constructions kernel), but even with simple Cartesian it runs. – triple_r Jul 18, 2014 at 14:18 Using CGAL::Homogeneous instead of CGAL::Simple_cartesian it runs so it seems to be a kernel problem (for CGAL4.4). Can you suggest what could be the reason of this kernel dependent problem? – DOFHandler Jul 21, 2014 at 9:13 Unfortunately I have no idea. But, since it works with the Cartesian kernel in 4.3, maybe a change in 4.4 made that kernel buggy in this case? Have you tried reporting this to CGAL community as a potential bug? – triple_r Jul 21, 2014 at 21:53 @DOFHandler have you worked out what was going on? I have this very strange bug which might be related. github.com/Oslandia/SFCGAL/issues/139 – Jesse Pepper May 29, 2017 at 8:47

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.