I'm trying to discover a faster algorithm for testing whether an axis-aligned conical surface intersects the volume of an axis-aligned bounding box.
The current algorithm I developed is as follows:
Can anyone think of a more efficient one? This seems to do a lot of extra work by computing each line intersection.
EDIT:
Above algorithm is bad, for example:
The cone can intersect only one edge of the box in a way that all the axis-line intersections are on one side, so the above algorithm doesn't work unless all edges are tested or the edges to be tested are intelligently chosen (maybe the edges closest to the cone?).
EDIT EDIT: See my own answer below for the solution I later discovered, which seems nearly optimal to me.
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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With