diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-07-15 20:25:43 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-07-15 20:25:43 -0600 |
commit | c1fefc78d46764845c406b60015188cc8f5207a9 (patch) | |
tree | 9825d20d4c49dd2db70a2a3efd70c378e1c25d3b /libdimension/prtree.c | |
parent | d543caf4ad629ec5313463f6e78e5931c406a353 (diff) | |
download | dimension-c1fefc78d46764845c406b60015188cc8f5207a9.tar.xz |
Add descriptive comment to new branchless ray-AABB intersection tests.
Diffstat (limited to 'libdimension/prtree.c')
-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; |