我想在基于 epeck 内核的应用程序中使用 CGAL 凸分区,但尝试编译此类分区会引发以下错误:
错误:
no matching constructor for initialization of 'CGAL::Partition_vertex<CGAL::Partition_traits_2<CGAL::Epeck> >'
一个简单的测试用例是,例如,从发行版中获取greene_approx_convex_partition_2.cpp
示例,并尝试将内核参数化更改为 epeck
。
epeck
内核是否/是否可以支持 2D convex partitioning
例程? 任何指示或建议非常感谢!
非常感谢,
这是一个解决方法:
--- 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;
我还
注意到,虽然使用 epeck greene_approx_convex_partition_2
会导致上面提到的编译器错误,但替代approx_convex_partition_2
开箱即用的 epeck 编译得很好。