Search code examples
cgal

CGAL: Is 2D poly partitioning supported with epeck kernel?


I'd like to use CGAL convex partitioning in an application that is based on the epeck kernel, but trying to compile such throws the following error:

error:

 no matching constructor for initialization of 'CGAL::Partition_vertex<CGAL::Partition_traits_2<CGAL::Epeck> >'

A simple test case for this is to take, for example, the greene_approx_convex_partition_2.cpp example from the distribution and try to change the kernel parameterization to epeck.

Are/can the 2D convex partitioning routines supported on an epeck kernel? Any pointers or advice much appreciated!

thanks much,


Solution

  • Here is a workaround:

    
    --- a/include/CGAL/Partition_2/Indirect_edge_compare.h
    +++ b/include/CGAL/Partition_2/Indirect_edge_compare.h
    @@ -69,7 +69,7 @@ class Indirect_edge_compare
             else 
             { 
                // construct supporting line for edge
    -           Line_2  line = _construct_line_2(*edge_vtx_1, *edge_vtx_2);
    +           Line_2  line = _construct_line_2((Point_2)*edge_vtx_1, (Point_2)*edge_vtx_2);
                return _compare_x_at_y_2(*vertex, line) == SMALLER;
             }
          }               
    @@ -98,10 +98,10 @@ class Indirect_edge_compare
    
             // else neither endpoint is shared
             // construct supporting line
    -        Line_2  l_p = _construct_line_2(*p, *after_p);
    +        Line_2  l_p = _construct_line_2((Point_2)*p, (Point_2)*after_p);
             if (_is_horizontal_2(l_p)) 
             {
    -            Line_2  l_q = _construct_line_2(*q, *after_q);
    +            Line_2  l_q = _construct_line_2((Point_2)*q, (Point_2)*after_q);
    
                 if (_is_horizontal_2(l_q))  
                 {                         
    @@ -130,7 +130,7 @@ class Indirect_edge_compare
                 return q_larger_x;
             // else one smaller and one larger
             // construct the other line
    -        Line_2 l_q = _construct_line_2(*q, *after_q); 
    +        Line_2 l_q = _construct_line_2((Point_2)*q, (Point_2)*after_q); 
             if (_is_horizontal_2(l_q))     // p is not horizontal
             {
                 return _compare_x_at_y_2((*q), l_p) == LARGER;