CGAL可见性计算错误的可见性多边形(简单多边形可见性算法)

时间:2019-10-05 00:16:13

标签: c++ cgal

我必须计算给定多边形的某些顶点的可见性多边形。我正在使用CGAL的可见性计算库,但是对于this example polygon及其第35个顶点(还有更多点),将计算以下(显然是错误的)result,其中可见性多边形的一条边相交原始边缘。

我使用以下代码进行构造:

rput = requests.put('http://localhost:8080/proxy/8082/har',headers={"Content-Type":"application/json"},data={"captureHeaders":True,"captureCookies":True,"captureContent":True})

这是CGALs实现中的错误还是我的代码中的错误?

编辑: 将算法更改为 typedef CGAL::Arrangement_2<CGAL::Arr_segment_traits_2<Epeck>> Arrangement_2; Arrangement_2 polygon_arr; CGAL::insert(polygon_arr, polygon.edges_begin(), polygon.edges_end()); Arrangement_2 vp_output; CGAL::Simple_polygon_visibility_2<Arrangement_2, CGAL::Tag_false> non_regular_visibility(polygon_arr); // ci is vertex circulator Arrangement_2::Halfedge_const_handle preceding_he = std::find_if(polygon_arr.halfedges_begin(),polygon_arr.halfedges_end(), [&ci](const typename Arrangement_2::Halfedge &e) { return !e.face()->is_unbounded() && e.target()->point() == *ci; } ); non_regular_visibility.compute_visibility(*ci, preceding_he, vp_output); for (auto eit = vp_output.edges_begin(); eit != vp_output.edges_end(); ++eit) { segments.push_back(eit->curve()); } (第7页)解决了这个问题,因此可能是CGAL中的错误。

1 个答案:

答案 0 :(得分:1)

您是对的,这是CGAL中的错误。我为此创建了一个问题:https://github.com/CGAL/cgal/issues/4289