【发布时间】:2011-06-17 08:25:11
【问题描述】:
我对某些点进行了 Delaunay 三角剖分,并希望按长度升序迭代其中的所有边以构建最小跨度线程。
我尝试了以下方法,但无法编译:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> T;
typedef K::Point_2 P;
typedef T::Vertex_handle Vh;
typedef T::Vertex_iterator Vi;
typedef T::Edge_iterator Ei;
bool sortFunction (Ei a, Ei b) {
K::FT la, lb;
la = CGAL::squared_distance(a.source().point(), a.target().point());
lb = CGAL::squared_distance(b.source().point(), b.target().point());
return la < lb;
}
...
T g;
...
std::vector<Ei> edges;
for (Ei ei = g.edges_begin(); ei != g.edges_end(); ei++) {
edges.push_back(ei);
}
std::sort(edges.begin(), edges.end(), sortFunction);
...
在sortFunction编译失败,说source不是Edge_iterator的成员。但是,这里的文档让我感到困惑。
CGAL documentation 表示边迭代器的值类型是半边。
There据说可以使用source()和target()来获取积分。
但是,情况似乎并非如此。我在这里搞砸了什么?
【问题讨论】:
标签: c++ compiler-errors cgal