Search code examples
c++graphvisibilitycgal

Troubles with the CGAL library Vertex_visibility_graph_2.h


I'm having troubles with the CGAL library Vertex_visibility_graph_2.h, for visibility graphs. The code I'm trying is like the following:

    typedef CGAL::Cartesian<CGAL::Gmpq> Kernel;
    typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
    typedef CGAL::Vertex_visibility_graph_2<Traits_2> Vis_graph;  
    typedef CGAL::Polygon_2<Kernel> Polygon_2;

    Vis_graph graph(polygon.vertices_begin(), polygon.vertices_end());

But when I try to compile, I get the error:

/opt/local/include/CGAL/Partition_2/Vertex_visibility_graph_2_impl.h:528:30: error: 
      no matching function for call to object of type 'Intersect_2' (aka
      'CGAL::Arr_segment_traits_2<CGAL::Cartesian<CGAL::Gmpq>>::Intersect_2')

Has anybody used that library before?


Solution

  • You need to replace: typedef CGAL::Vertex_visibility_graph_2<Traits_2> Vis_graph; by typedef CGAL::Vertex_visibility_graph_2<Kernel> Vis_graph;