diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-05-08 13:04:42 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-05-08 13:04:42 -0600 |
commit | 152362a57dc7fe9dce830ef69118984f854d6375 (patch) | |
tree | 43599d21a04e698a3874e5af1dd70566e472ca66 /libdimension/cube.c | |
parent | 0335b8141b4ab35a94a8f1653a86defcd6768012 (diff) | |
download | dimension-152362a57dc7fe9dce830ef69118984f854d6375.tar.xz |
Handle degenerate cases in ray/box intersections.
Diffstat (limited to 'libdimension/cube.c')
-rw-r--r-- | libdimension/cube.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libdimension/cube.c b/libdimension/cube.c index 4c09d04..84b1553 100644 --- a/libdimension/cube.c +++ b/libdimension/cube.c @@ -82,6 +82,9 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line, if (tmin > tmax) return false; + } else { + if (line_trans.x0.x < -1.0 || line_trans.x0.x > 1.0) + return false; } if (line_trans.n.y != 0.0) { @@ -110,6 +113,9 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line, if (tmin > tmax) return false; + } else { + if (line_trans.x0.y < -1.0 || line_trans.x0.y > 1.0) + return false; } if (line_trans.n.z != 0.0) { @@ -138,6 +144,9 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line, if (tmin > tmax) return false; + } else { + if (line_trans.x0.z < -1.0 || line_trans.x0.z > 1.0) + return false; } if (tmin < 0.0) { |