How do I efficiently calculate area of a 3D triangle inside an axis-aligned bounding box?

700 views Asked by At

I want to know the area of a 3D triangle inside an axis-aligned bounding box (AABB). I have already determined how to efficiently detect a collision between the triangle and AABB using the method presented here:

http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/pubs/tribox.pdf

However, I have not found a good algorithm for computing the area of the triangle inside of the AABB. If I were to self-roll a solution, it would look like:

  1. Detect tri-AABB overlap
  2. Test is triangle is inside AABB -> return area
  3. For each side of the AABB, make a plane
  4. Clip the triangle for each of the 6 generated planes. If more than 3 side result from the clip make into new triangles
  5. Loop through new triangle set and goto #2 until no triangle are left in the set

I think this should result in a set of triangles all inside the AABB, and therefore, the sum of their area is the area of the base triangle inside the AABB?

1

There are 1 answers

0
Matt Timmermans On

I would probably:

  1. Treat the triangle as a convex polygon and clip it against each of the BB planes
  2. Transform to a 2D polygon in the polygon's plane
  3. Calculate its area using the Shoelace Formula