Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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,

like image 497
user3781651 Avatar asked Dec 29 '25 16:12

user3781651


1 Answers

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());
like image 193
sloriot Avatar answered Jan 04 '26 08:01

sloriot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!