user3781651
user3781651

Reputation: 31

2D Delaunay triangulation in CGAL using an arbitrary plane

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,

Upvotes: 3

Views: 366

Answers (1)

sloriot
sloriot

Reputation: 6253

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());

Upvotes: 5

Related Questions