diff options
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/prtree.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libdimension/prtree.c b/libdimension/prtree.c index 43400a3..6ca6058 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -544,6 +544,15 @@ static inline bool dmnsn_ray_box_intersection(dmnsn_optimized_line optline, dmnsn_bounding_box box, double t) { + /* + * This is actually correct, even though it appears not to handle edge cases + * (line.n.{x,y,z} == 0). It works because the infinities that result from + * dividing by zero will still behave correctly in the comparisons. Lines + * which are parallel to an axis and outside the box will have tmin == inf + * or tmax == -inf, while lines inside the box will have tmin and tmax + * unchanged. + */ + /* Degenerate box test */ if (box.min.x >= box.max.x) return false; |