1616#include < gtest/gtest.h>
1717
1818#include < CGAL/AABB_face_graph_triangle_primitive.h>
19+ #if CGAL_VERSION_MAJOR >= 6
20+ #include < CGAL/AABB_traits_3.h>
21+ #else
1922#include < CGAL/AABB_traits.h>
23+ #endif
2024#include < CGAL/AABB_tree.h>
2125#include < CGAL/Constrained_Delaunay_triangulation_2.h>
2226#include < CGAL/Constrained_triangulation_2.h>
3337
3438#include < CGAL/algorithm.h>
3539#include < CGAL/boost/graph/Euler_operations.h>
40+ #include < CGAL/boost/graph/generators.h>
3641#include < CGAL/number_utils.h>
3742#include < CGAL/point_generators_2.h>
3843
@@ -137,12 +142,23 @@ TEST(CGAL, SurfaceMesh) {
137142 typedef K::Segment_3 Segment;
138143 typedef CGAL ::Surface_mesh<Point3> Mesh;
139144 typedef CGAL ::AABB_face_graph_triangle_primitive<Mesh> Primitive;
145+ #if CGAL_VERSION_MAJOR >= 6
146+ typedef CGAL ::AABB_traits_3<K, Primitive> Traits;
147+ #else
140148 typedef CGAL ::AABB_traits<K, Primitive> Traits;
149+ #endif
141150 typedef CGAL ::AABB_tree<Traits> Tree;
151+ #if CGAL_VERSION_MAJOR >= 6
152+ typedef std::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
153+ Segment_intersection;
154+ typedef std::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
155+ Plane_intersection;
156+ #else
142157 typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
143158 Segment_intersection;
144159 typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
145160 Plane_intersection;
161+ #endif
146162 typedef Tree::Primitive_id Primitive_id;
147163
148164 Point3 p (1.0 , 0.0 , 0.0 );
@@ -177,8 +193,13 @@ TEST(CGAL, SurfaceMesh) {
177193 tree.any_intersection (segment_query);
178194 if (intersection) {
179195 // gets intersection object
196+ #if CGAL_VERSION_MAJOR >= 6
197+ if (std::get_if<Point3>(&(intersection->first ))) {
198+ // Point3* p = std::get_if<Point3>(&(intersection->first));
199+ #else
180200 if (boost::get<Point3>(&(intersection->first ))) {
181201 // Point3* p = boost::get<Point3>(&(intersection->first));
202+ #endif
182203 // std::cout << "intersection object is a point " << *p << "\n";
183204 // std::cout << "with face "<< intersection->second << "\n";
184205 }
@@ -203,8 +224,13 @@ TEST(CGAL, SurfaceMesh) {
203224 // (generally a segment)
204225 Plane_intersection plane_intersection = tree.any_intersection (plane_query);
205226 if (plane_intersection) {
227+ #if CGAL_VERSION_MAJOR >= 6
228+ if (std::get_if<Segment>(&(plane_intersection->first ))) {
229+ // Segment* s = std::get_if<Segment>(&(plane_intersection->first));
230+ #else
206231 if (boost::get<Segment>(&(plane_intersection->first ))) {
207232 // Segment* s = boost::get<Segment>(&(plane_intersection->first));
233+ #endif
208234 // std::cout << "one intersection object is the segment " << s << "\n";
209235 // std::cout << "with face "<< intersection->second << "\n";
210236 }
@@ -223,7 +249,11 @@ TEST(CGAL, AABBPolyhedronFacetIntersection) {
223249 // typedef K::Segment_3 Segment;
224250 typedef CGAL ::Polyhedron_3<K> Polyhedron;
225251 typedef CGAL ::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
252+ #if CGAL_VERSION_MAJOR >= 6
253+ typedef CGAL ::AABB_traits_3<K, Primitive> Traits;
254+ #else
226255 typedef CGAL ::AABB_traits<K, Primitive> Traits;
256+ #endif
227257 typedef CGAL ::AABB_tree<Traits> Tree;
228258 // typedef Tree::Point_and_primitive_id Point_and_primitive_id;
229259
@@ -276,17 +306,25 @@ TEST(CGAL, SurfaceMeshGridCell) {
276306 // typedef Mesh::Face_index face_descriptor;
277307
278308 typedef CGAL ::AABB_face_graph_triangle_primitive<Mesh> Primitive;
309+ #if CGAL_VERSION_MAJOR >= 6
310+ typedef CGAL ::AABB_traits_3<K, Primitive> Traits;
311+ #else
279312 typedef CGAL ::AABB_traits<K, Primitive> Traits;
313+ #endif
280314 typedef CGAL ::AABB_tree<Traits> Tree;
281315 // typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
282316 // Segment_intersection;
283317 // typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
284318 // Plane_intersection;
285319 // typedef Tree::Primitive_id Primitive_id;
286320
321+ #if CGAL_VERSION_MAJOR >= 6
322+ typedef std::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
323+ Ray_intersection;
324+ #else
287325 typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
288326 Ray_intersection;
289-
327+ # endif
290328 typedef CGAL ::Timer Timer;
291329
292330 Point3 p0 (-1.0 , -1.0 , 1.0 );
@@ -344,8 +382,13 @@ TEST(CGAL, SurfaceMeshGridCell) {
344382 // std::cout << "Intersect (x1000): " << t.time() << " sec" << "\n";
345383
346384 // if(intersection) {
385+ #if CGAL_VERSION_MAJOR >= 6
386+ // if(std::get_if<Point3>(&(intersection->first))) {
387+ // const Point3* p = std::get_if<Point3>(&(intersection->first));
388+ #else
347389 // if(boost::get<Point3>(&(intersection->first))) {
348- // const Point3* p = boost::get<Point3>(&(intersection->first));
390+ // const Point3* p = boost::get<Point3>(&(intersection->first));
391+ #endif
349392 // std::cout << *p << "\n";
350393 // }
351394 // }
@@ -366,17 +409,25 @@ TEST(CGAL, SurfaceMeshGrid) {
366409 // typedef Mesh::Face_index face_descriptor;
367410
368411 typedef CGAL ::AABB_face_graph_triangle_primitive<Mesh> Primitive;
412+ #if CGAL_VERSION_MAJOR >= 6
413+ typedef CGAL ::AABB_traits_3<K, Primitive> Traits;
414+ #else
369415 typedef CGAL ::AABB_traits<K, Primitive> Traits;
416+ #endif
370417 typedef CGAL ::AABB_tree<Traits> Tree;
371418 // typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
372419 // Segment_intersection;
373420 // typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
374421 // Plane_intersection;
375422 // typedef Tree::Primitive_id Primitive_id;
376423
424+ #if CGAL_VERSION_MAJOR >= 6
425+ typedef std::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
426+ Ray_intersection;
427+ #else
377428 typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
378429 Ray_intersection;
379-
430+ # endif
380431 typedef CGAL ::Timer Timer;
381432
382433 // Create Grid
@@ -432,8 +483,13 @@ TEST(CGAL, SurfaceMeshGrid) {
432483 // << "): " << t.time() << " sec" << "\n";
433484
434485 // if(intersection) {
486+ #if CGAL_VERSION_MAJOR >= 6
487+ // if(std::get_if<Point3>(&(intersection->first))) {
488+ // const Point3* p = std::get_if<Point3>(&(intersection->first));
489+ #else
435490 // if(boost::get<Point3>(&(intersection->first))) {
436- // const Point3* p = boost::get<Point3>(&(intersection->first));
491+ // const Point3* p = boost::get<Point3>(&(intersection->first));
492+ #endif
437493 // std::cout << *p << "\n";
438494 // }
439495 // }
@@ -454,7 +510,11 @@ TEST(CGAL, SurfaceMeshModifyGrid) {
454510 // typedef Mesh::Face_index face_descriptor;
455511
456512 // typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
513+ #if CGAL_VERSION_MAJOR >= 6
514+ // typedef CGAL::AABB_traits_3<K, Primitive> Traits;
515+ #else
457516 // typedef CGAL::AABB_traits<K, Primitive> Traits;
517+ #endif
458518 // typedef CGAL::AABB_tree<Traits> Tree;
459519 // typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
460520 // Segment_intersection;
@@ -507,7 +567,7 @@ TEST(CGAL, SurfaceMeshWavefield) {
507567 // typedef Mesh::Face_index face_descriptor;
508568
509569 // typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
510- // typedef CGAL::AABB_traits <K, Primitive> Traits;
570+ // typedef CGAL::AABB_traits_3 <K, Primitive> Traits;
511571 // typedef CGAL::AABB_tree<Traits> Tree;
512572 // typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
513573 // Segment_intersection;
0 commit comments