Original Post
Hi guys, in the process of building an octree I am currently testing whether a triangle (strictly a triangle, no quads or other polygons) intersects an aabb (i.e. the node) the following way: -1) check if any vertices lie within the aabb, if so return intersect -2) check if all vertices lie outside of either of the 6 planes of the aabb, if so return no intersect -3) check if the edges of the polygons intersect the planes of the box, if yes return intersect -4) check if the diagonals of the aabb intersect the triangle and if so, return intersect I've been reading about the separating axis/plane theorem and many of the threads on this forum (it seems to be jyk's favorite method as he always mentions it ;) ) so I was thinking would using this algorithm mean I can get rid of all of the above tests? I'm looking for the most efficient algorithm, as I'm programming this for the Nintendo DS which isn't exactly powerful, so time is an issue. Just to be sure, would I: -1) perform 3 tests to check if the vertices lie in the box (1 for each direction) -2) perform 1 test for the closest diagonal to the triangle's normal against the triangle's plane and see where it intersects (would this not be long, as you'd first have to check where it intersects the triangle's plane, then test if this point lies "within" all of the 3 edge's planes?) -3) 9 cross product tests (3 for each direction of the aabb against each edge of the triangle)