Question

I've just started using CGAL to calculate the minkowski sum along a polyline - basically a 'glide' operation. There is a nice example of it here:

http://doc.cgal.org/latest/Minkowski_sum_3/index.html#Minkowski_sum_3Glide

Unfortunately, I run into troubles as soon as some points of the polyline are the equal. For example for a closed ring:

  Point_3 pl[6] =
    {Point_3(-100,0,0),
     Point_3(40,-70,0),
     Point_3(40,50,40),
     Point_3(-90,-60,60),
     Point_3(0, 0, -100),
     Point_3(-100,0,0)
  };

It results in

terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: N.is_valid(0,0)
File: /usr/include/CGAL/convex_decomposition_3.h
Line: 141
[1]    30341 done                 cat cube.nef3 | 
       30342 abort (core dumped)  ./glide

The backtrack looks like this:

0   raise   /usr/lib/libc.so.6      0x7ffff693a369  
1   abort   /usr/lib/libc.so.6      0x7ffff693b768  
2   __gnu_cxx::__verbose_terminate_handler()    /usr/lib/libstdc++.so.6     0x7ffff7228635  
3   ??  /usr/lib/libstdc++.so.6     0x7ffff72267a6  
4   std::terminate()    /usr/lib/libstdc++.so.6     0x7ffff72267d3  
5   __cxa_throw /usr/lib/libstdc++.so.6     0x7ffff72269fe  
6   CGAL::assertion_fail(char const*, char const*, int, char const*)    /usr/lib/libCGAL.so.10      0x7ffff76f9ee9  
7   CGAL::convex_decomposition_3<CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >   convex_decomposition_3.h    141 0x596500    
8   CGAL::minkowski_sum_3<CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >  minkowski_sum_3.h   91  0x59c691    
9   main    glide.cpp   35  0x4cbdfb    

Probably, Nef Polyhedra don't allow intersection.

Is there any way out of this? Help is really very much appreciated.

Was it helpful?

Solution

I did ask CGAL developers and they replied that the code does not allow self-intersecting polylines. You need to split your polylines yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top