如何在约束delaunay三角剖分中获取三角形的顶点
How to get vertices of a triangle in constraint delaunay triangulation?
我用cgal编写了一个程序,如下所示:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2,K> Fbb;
typedef CGAL::Constrained_triangulation_face_base_2<K,Fbb> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CDT::Point Point;
typedef CGAL::Polygon_2<K> Polygon_2;
int main( )
{
//construct two non-intersecting nested polygons
Polygon_2 polygon1;
polygon1.push_back(Point(0,0));
polygon1.push_back(Point(2,0));
polygon1.push_back(Point(2,2));
polygon1.push_back(Point(0,2));
CDT cdt;
insert_polygon(cdt,polygon1);
CDT::Finite_faces_iterator t=cdt.faces_begin();
for (t = cdt.finite_faces_begin(); t != cdt.finite_faces_end(); t++)
{
//how can i achieve that?
}
}
在for循环的每次迭代中,我想得到从cdt.finite_faces_begin()
到t
指向的三角形的顶点。
例如在循环的第一次迭代中,我得到了第一个三角形的顶点,在循环的第二次迭代中我得到了第1+第二个三角形的顶部,在第三次迭代中得到了第一+第二+第三个三角的顶点,依此类推。我怎样才能做到这一点?
如果在第i次迭代中只希望面的三个顶点使用for(inti=0;i<3;++i){t->vertex(i);}
或t->vertex(i)->point()
。
如果不希望获得已从上一个面获得的顶点,则必须使用在循环外声明的std::set<Vertex_handle>
。
相关文章:
- C++为构建时间获取QDateTime的可靠方法
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 使用指针从C++中的数组中获取最大值
- 如何获取std::result_of函数的返回类型
- 如何在openssl-ecc中获取十六进制格式的私钥
- 使用Unreal C++获取VR耳机的世界位置/方向
- 获取日期异步信号安全吗?如果在信号处理程序中使用,它会导致死锁吗
- 从C字符串中获取奇怪的字符串长度
- 为什么我的for循环不能正确获取argv
- 从python中调用C++函数并获取返回值
- 如何获取一个数字的前3位
- 获取字符串的长度并将其分配给数组
- 无法获取菜单选择以运行函数.C++
- 数组长度,为什么从命令行获取时不能使用它?
- Boost Spirit,获取迭代器内部语义动作
- 尝试通过OCI例程从Oracle获取blob数据,但出现错误:ORA-01008:并非所有变量都绑定
- 具有默认值的引用获取函数
- xmake总是报告:错误:无法获取cxx的程序,为什么
- 如何在约束delaunay三角剖分中获取三角形的顶点