MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_self_intersections

Function test_self_intersections

tests/geometry/test-aabb.cpp:402–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400
401template < geode::index_t dimension >
402void 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
435template < geode::index_t dimension >
436class OtherAABBIntersection

Callers

nothing calls this directly

Calls 8

infoFunction · 0.85
insertMethod · 0.80
testFunction · 0.70
endMethod · 0.45
beginMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected