问题
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?
thanks,
回答1:
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());
来源:https://stackoverflow.com/questions/24443726/2d-delaunay-triangulation-in-cgal-using-an-arbitrary-plane