CGAL 中使用任意平面的 2D Delaunay 三角剖分 [英] 2D Delaunay triangulation in CGAL using an arbitrary plane
问题描述
我刚开始使用 CGAL,我想知道 CGAL 是否支持使用任意平面对 3D 点进行 2D Delaunay 三角剖分.CGAL 文档中的示例仅列出了 Projection_traits_xy_3
、Projection_traits_yz_3
和 Projection_traits_xz_3
,换句话说,投影在xy 平面、yz 平面和 xz 平面.有什么方法可以定义任意投影平面而不是使用 xy、yz 和 xz 平面?
I am new to using CGAL, and I was wondering if CGAL supports 2D Delaunay triangulation of 3D points using an arbitrary plane. The example on CGAL's documentation lists only Projection_traits_xy_3<R>
, Projection_traits_yz_3<R>
, and Projection_traits_xz_3<R>
, in other words, projection on the xy plane, the yz plane and the xz plane. Is there any way I can define an arbitrary projection plane instead of using the xy, yz and xz planes?
谢谢,
推荐答案
有一个模板 <类内核 >类 Triangulation_2_projection_traits_3
未记录且在标题中定义的:CGAL/Triangulation_2_projection_traits_3.h
.
There is a template < class Kernel > class Triangulation_2_projection_traits_3
that is not documented and that is defined in the header: CGAL/Triangulation_2_projection_traits_3.h
.
您从平面法线构造特征类并将特征传递给三角剖分.
You construct the traits class from the plane normal and pass the traits to the triangulation.
类似以下内容应该可以:
Something like the following should work:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_2_projection_traits_3<K> P_traits;
typedef CGAL::Delaunay_triangulation_2< P_traits > DT2;
std::vector< K::Point_3 > points
P_traits traits( K::Vector_3(1,1,1) );
DT2 dt2(traits);
dt2.insert(points.begin(), points.end());
这篇关于CGAL 中使用任意平面的 2D Delaunay 三角剖分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!