Infinite cone surface * AABB intersection testing
I found a possibly optimal solution:
The equation for a unit right cone opening along the +-z axis is x^2 + y^2 - z^2 = 0
.
Find the maximum and minimum of x^2 + y^2 - z^2
over the AABB using interval arithmatic. Hint: For x^2
, the minimum is clamp(0, [xmin, xmax])^2
and the maximum is max(xmin^2, xmax^2)
.
- If the resulting interval is completely negative, the box is completely inside the cone.
- If the resulting interval contains 0, the box intersects the surface of the cone.
- If the resulting interval is completely positive, the box is completely outside of the cone.
Looking at this table of object/object intersection tests it seems that there's no well-known cone/AABB intersection test. So you're on your own, I'm afraid!
You might start with David Eberly's article "Intersection of a Triangle and a Cone" and see how much of that you can adapt to your situation. (In the worst case, an AABB is made up of 12 triangles, but I expect you can do better than that.)