The easiest trick is to split the rectangle into two triangles and test two intersections.

YutianW

Why when there's no intersection the interval is empty? Even if there's not interaction with the box, the ray still creates same number of intersections with the planes, and that doesn't seem to reduce the number of intervals.

Starboy

We can know that the ray misses the box if the two tmin/tmax intervals do not intersect. But do we also need to make sure the intersection is positive?

coolpotato

I'm still confused by this idea of taking the intersection of the tmin, tmax intervals. Is there case where the intersection of these intervals produce an interval that is nonempty yet still does not intersect the box?

large_monkey

What is the complexity of extending this to work with general polygons, and in higher dimensions, other representations of meshes? I would think that it would be too naive to intersect a ray with every possible segment, and there could be easy ways to speed this up (for example, by discarding large regions of space at a time).

anag

Would it also miss the box if the intersection is entirely negative? I think there is a case where it misses the box but the min/max intervals do intersect -- like if the ray in the example was actually going in the negative direction. Then tmin and tmax would both be negative. I can imagine the intersection being totally empty if the point/ray is below/above both planes for an axis, though.

Mogician

Would bounding box not aligned to axis in some way performs better because of a tighter volume? How much is the benefit gain compared to the performance loss?

The easiest trick is to split the rectangle into two triangles and test two intersections.

Why when there's no intersection the interval is empty? Even if there's not interaction with the box, the ray still creates same number of intersections with the planes, and that doesn't seem to reduce the number of intervals.

We can know that the ray misses the box if the two tmin/tmax intervals do not intersect. But do we also need to make sure the intersection is positive?

I'm still confused by this idea of taking the intersection of the tmin, tmax intervals. Is there case where the intersection of these intervals produce an interval that is nonempty yet still does not intersect the box?

What is the complexity of extending this to work with general polygons, and in higher dimensions, other representations of meshes? I would think that it would be too naive to intersect a ray with every possible segment, and there could be easy ways to speed this up (for example, by discarding large regions of space at a time).

Would it also miss the box if the intersection is entirely negative? I think there is a case where it misses the box but the min/max intervals do intersect -- like if the ray in the example was actually going in the negative direction. Then tmin and tmax would both be negative. I can imagine the intersection being totally empty if the point/ray is below/above both planes for an axis, though.

Would bounding box not aligned to axis in some way performs better because of a tighter volume? How much is the benefit gain compared to the performance loss?