16
16
#include < gtest/gtest.h>
17
17
18
18
#include < CGAL/AABB_face_graph_triangle_primitive.h>
19
+ #if CGAL_VERSION_MAJOR >= 6
20
+ #include < CGAL/AABB_traits_3.h>
21
+ #else
19
22
#include < CGAL/AABB_traits.h>
23
+ #endif
20
24
#include < CGAL/AABB_tree.h>
21
25
#include < CGAL/Constrained_Delaunay_triangulation_2.h>
22
26
#include < CGAL/Constrained_triangulation_2.h>
@@ -137,12 +141,23 @@ TEST(CGAL, SurfaceMesh) {
137
141
typedef K::Segment_3 Segment;
138
142
typedef CGAL::Surface_mesh<Point3> Mesh;
139
143
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
144
+ #if CGAL_VERSION_MAJOR >= 6
145
+ typedef CGAL::AABB_traits_3<K, Primitive> Traits;
146
+ #else
140
147
typedef CGAL::AABB_traits<K, Primitive> Traits;
148
+ #endif
141
149
typedef CGAL::AABB_tree<Traits> Tree;
150
+ #if CGAL_VERSION_MAJOR >= 6
151
+ typedef std::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
152
+ Segment_intersection;
153
+ typedef std::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
154
+ Plane_intersection;
155
+ #else
142
156
typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
143
157
Segment_intersection;
144
158
typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
145
159
Plane_intersection;
160
+ #endif
146
161
typedef Tree::Primitive_id Primitive_id;
147
162
148
163
Point3 p (1.0 , 0.0 , 0.0 );
@@ -177,8 +192,13 @@ TEST(CGAL, SurfaceMesh) {
177
192
tree.any_intersection (segment_query);
178
193
if (intersection) {
179
194
// gets intersection object
195
+ #if CGAL_VERSION_MAJOR >= 6
196
+ if (std::get_if<Point3>(&(intersection->first ))) {
197
+ // Point3* p = std::get_if<Point3>(&(intersection->first));
198
+ #else
180
199
if (boost::get<Point3>(&(intersection->first ))) {
181
200
// Point3* p = boost::get<Point3>(&(intersection->first));
201
+ #endif
182
202
// std::cout << "intersection object is a point " << *p << "\n";
183
203
// std::cout << "with face "<< intersection->second << "\n";
184
204
}
@@ -203,8 +223,13 @@ TEST(CGAL, SurfaceMesh) {
203
223
// (generally a segment)
204
224
Plane_intersection plane_intersection = tree.any_intersection (plane_query);
205
225
if (plane_intersection) {
226
+ #if CGAL_VERSION_MAJOR >= 6
227
+ if (std::get_if<Segment>(&(plane_intersection->first ))) {
228
+ // Segment* s = std::get_if<Segment>(&(plane_intersection->first));
229
+ #else
206
230
if (boost::get<Segment>(&(plane_intersection->first ))) {
207
231
// Segment* s = boost::get<Segment>(&(plane_intersection->first));
232
+ #endif
208
233
// std::cout << "one intersection object is the segment " << s << "\n";
209
234
// std::cout << "with face "<< intersection->second << "\n";
210
235
}
@@ -223,7 +248,11 @@ TEST(CGAL, AABBPolyhedronFacetIntersection) {
223
248
// typedef K::Segment_3 Segment;
224
249
typedef CGAL::Polyhedron_3<K> Polyhedron;
225
250
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
251
+ #if CGAL_VERSION_MAJOR >= 6
252
+ typedef CGAL::AABB_traits_3<K, Primitive> Traits;
253
+ #else
226
254
typedef CGAL::AABB_traits<K, Primitive> Traits;
255
+ #endif
227
256
typedef CGAL::AABB_tree<Traits> Tree;
228
257
// typedef Tree::Point_and_primitive_id Point_and_primitive_id;
229
258
@@ -276,17 +305,25 @@ TEST(CGAL, SurfaceMeshGridCell) {
276
305
// typedef Mesh::Face_index face_descriptor;
277
306
278
307
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
308
+ #if CGAL_VERSION_MAJOR >= 6
309
+ typedef CGAL::AABB_traits_3<K, Primitive> Traits;
310
+ #else
279
311
typedef CGAL::AABB_traits<K, Primitive> Traits;
312
+ #endif
280
313
typedef CGAL::AABB_tree<Traits> Tree;
281
314
// typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
282
315
// Segment_intersection;
283
316
// typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
284
317
// Plane_intersection;
285
318
// typedef Tree::Primitive_id Primitive_id;
286
319
320
+ #if CGAL_VERSION_MAJOR >= 6
321
+ typedef std::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
322
+ Ray_intersection;
323
+ #else
287
324
typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
288
325
Ray_intersection;
289
-
326
+ # endif
290
327
typedef CGAL::Timer Timer;
291
328
292
329
Point3 p0 (-1.0 , -1.0 , 1.0 );
@@ -344,8 +381,13 @@ TEST(CGAL, SurfaceMeshGridCell) {
344
381
// std::cout << "Intersect (x1000): " << t.time() << " sec" << "\n";
345
382
346
383
// if(intersection) {
384
+ #if CGAL_VERSION_MAJOR >= 6
385
+ // if(std::get_if<Point3>(&(intersection->first))) {
386
+ // const Point3* p = std::get_if<Point3>(&(intersection->first));
387
+ #else
347
388
// if(boost::get<Point3>(&(intersection->first))) {
348
- // const Point3* p = boost::get<Point3>(&(intersection->first));
389
+ // const Point3* p = boost::get<Point3>(&(intersection->first));
390
+ #endif
349
391
// std::cout << *p << "\n";
350
392
// }
351
393
// }
@@ -366,17 +408,25 @@ TEST(CGAL, SurfaceMeshGrid) {
366
408
// typedef Mesh::Face_index face_descriptor;
367
409
368
410
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
411
+ #if CGAL_VERSION_MAJOR >= 6
412
+ typedef CGAL::AABB_traits_3<K, Primitive> Traits;
413
+ #else
369
414
typedef CGAL::AABB_traits<K, Primitive> Traits;
415
+ #endif
370
416
typedef CGAL::AABB_tree<Traits> Tree;
371
417
// typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
372
418
// Segment_intersection;
373
419
// typedef boost::optional<Tree::Intersection_and_primitive_id<Plane>::Type>
374
420
// Plane_intersection;
375
421
// typedef Tree::Primitive_id Primitive_id;
376
422
423
+ #if CGAL_VERSION_MAJOR >= 6
424
+ typedef std::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
425
+ Ray_intersection;
426
+ #else
377
427
typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type>
378
428
Ray_intersection;
379
-
429
+ # endif
380
430
typedef CGAL::Timer Timer;
381
431
382
432
// Create Grid
@@ -432,8 +482,13 @@ TEST(CGAL, SurfaceMeshGrid) {
432
482
// << "): " << t.time() << " sec" << "\n";
433
483
434
484
// if(intersection) {
485
+ #if CGAL_VERSION_MAJOR >= 6
486
+ // if(std::get_if<Point3>(&(intersection->first))) {
487
+ // const Point3* p = std::get_if<Point3>(&(intersection->first));
488
+ #else
435
489
// if(boost::get<Point3>(&(intersection->first))) {
436
- // const Point3* p = boost::get<Point3>(&(intersection->first));
490
+ // const Point3* p = boost::get<Point3>(&(intersection->first));
491
+ #endif
437
492
// std::cout << *p << "\n";
438
493
// }
439
494
// }
@@ -454,7 +509,11 @@ TEST(CGAL, SurfaceMeshModifyGrid) {
454
509
// typedef Mesh::Face_index face_descriptor;
455
510
456
511
// typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
512
+ #if CGAL_VERSION_MAJOR >= 6
513
+ // typedef CGAL::AABB_traits_3<K, Primitive> Traits;
514
+ #else
457
515
// typedef CGAL::AABB_traits<K, Primitive> Traits;
516
+ #endif
458
517
// typedef CGAL::AABB_tree<Traits> Tree;
459
518
// typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
460
519
// Segment_intersection;
@@ -507,7 +566,7 @@ TEST(CGAL, SurfaceMeshWavefield) {
507
566
// typedef Mesh::Face_index face_descriptor;
508
567
509
568
// typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
510
- // typedef CGAL::AABB_traits <K, Primitive> Traits;
569
+ // typedef CGAL::AABB_traits_3 <K, Primitive> Traits;
511
570
// typedef CGAL::AABB_tree<Traits> Tree;
512
571
// typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
513
572
// Segment_intersection;
0 commit comments