| 400 | |
| 401 | template < geode::index_t dimension > |
| 402 | void test_self_intersections() |
| 403 | { |
| 404 | geode::Logger::info( |
| 405 | "TEST", " Box self intersection AABB ", dimension, "D " ); |
| 406 | |
| 407 | const geode::index_t nb_boxes{ 10 }; |
| 408 | // Create a grid of intersecting boxes |
| 409 | auto box_vector = create_box_vector< dimension >( nb_boxes, 0.75 ); |
| 410 | // Create a grid of tangent boxes included in previous boxes |
| 411 | const auto box_vector2 = create_box_vector< dimension >( nb_boxes, 0.50 ); |
| 412 | box_vector.insert( |
| 413 | box_vector.end(), box_vector2.begin(), box_vector2.end() ); |
| 414 | |
| 415 | geode::AABBTree< dimension > aabb{ box_vector }; |
| 416 | |
| 417 | BoxAABBIntersection< dimension > eval_intersection{ box_vector }; |
| 418 | // investigate box inclusions |
| 419 | eval_intersection.included_box_.clear(); |
| 420 | aabb.compute_self_element_bbox_intersections( eval_intersection ); |
| 421 | |
| 422 | geode::OpenGeodeGeometryException::test( |
| 423 | eval_intersection.included_box_.size() == nb_boxes * nb_boxes, |
| 424 | "Box self intersection - Every box should have one box " |
| 425 | "inside" ); |
| 426 | |
| 427 | for( const auto& result : eval_intersection.included_box_ ) |
| 428 | { |
| 429 | geode::OpenGeodeGeometryException::test( |
| 430 | result.first == result.second - ( nb_boxes * nb_boxes ), |
| 431 | "Box self intersection - Wrong box inclusion result" ); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | template < geode::index_t dimension > |
| 436 | class OtherAABBIntersection |