Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Apr 16, 2024
1 parent d35fd00 commit 0c2deb1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/geometry/ArborX_DetailsAlgorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,22 @@ struct intersects<BoxTag, TriangleTag, Box, Triangle>
{
// Based on the Separating Axis Theorem
// https://doi.org/10.1145/1198555.1198747

// Test bounding boxes, i.e., normals of the box
// we have to project the box and the triangle onto 13 axes and check for
// overlap. These axes are:
// - the 3 normals of the box
// - the normal of the triangle
// - the 9 crossproduct between the 3 edge (directions) of the box and the 3
// edges of the triangle

// Testing the normals of the box is the same as testing the overlap of
// bounding boxes.
Box triangle_bounding_box;
ArborX::Details::expand(triangle_bounding_box, triangle);
if (!ArborX::Details::intersects(triangle_bounding_box, box))
return false;

// shift to origin
// shift box and triangle so that the box's center is at the origin to
// simplify the following checks.
constexpr int DIM = GeometryTraits::dimension_v<Triangle>;
static_assert(DIM == 3,
"Box-Triangle intersection only implemented in 3d!");
Expand Down

0 comments on commit 0c2deb1

Please sign in to comment.