0
\$\begingroup\$

I'm studying ray-AABB intersections and I'm asking myself: what would happen if one of the dimensions of the axis aligned bounding box was degenerated?

For instance:

AABB_min = {1,1,1}
AABB_max = {5,5,1}

in this case the Z coordinate would be the same for the AABB maximum and minimum point. You can think of this AABB as a 2D rectangle.

In such a case, would this always yield "true" as intersection with a ray if the ray's Tmax and Tmin were something like +inf and -inf (so that we don't need to bother with them)?

\$\endgroup\$
  • \$\begingroup\$ I'm not sure if I understand. It's trivial to see that a 2D ray doesn't necessarily intersect a 2D rectangle. \$\endgroup\$ – Anko Feb 5 '14 at 13:22
  • \$\begingroup\$ 3D ray, and for @concept3d I was referring to this algorithm: scratchapixel.com/lessons/3d-basic-lessons/… \$\endgroup\$ – Marco A. Feb 5 '14 at 13:23
  • \$\begingroup\$ @DavidKernin I edited my answer. \$\endgroup\$ – concept3d Feb 5 '14 at 13:46
1
\$\begingroup\$

The example you provided is not a degenerate case, and it works. This will give correct results. You didn't mention which algorithm you are talking about but I assume you're talking about the SLABS method (correct me if I am wrong).

The OP was talking about this paper, which is similar to the slabs method and my explanation almost remains the same.

I don't know why you assume Tmin and Tmax will be +/-inf, they will simply be equal for the z coordinates, in other words TminZ = TmaxZ. Keep in mind that for Tmin, Tmax to make sense they are calculated for each axis independently.

The case is valid for Tmin and Tmax being +/-infinity the quote from the paper.

Note that the reason we check the sign of each component direction is to ensure that the intervals produced are ordered (i.e., so that tmin <= tmax is true). This property is assumed throughout the code, and allows us to reason about whether the computed intervals overlap. Note also that since IEEE arithmetic guarantees that a positive number divided by zero is +1 and a negative number divided by zero is ¡1, the code works for vertical and horizontal lines (see 2 for a detailed discussion of this)

Note that your degenerate case was not when Zmin = Zmax. your missing point was when a ray is parallel to a certain axis which could yield Tz = +/-inf.

If you have a case where the bounding box min > max then this is not an AABB, and according to the algorithm it doesn't apply since max>min is a pre-condition for any ray/AABB algorithm; that input is undefined for that certain algorithm.

Moreover any anlytical or algebraic solution should define the domain of the problem (domain as in mathematics) on the input, otherwise running that solution on that input is undefined. And the example you provided is defined for that particular algorithm.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.