geom/ray: use infinity, not nan, to signal no intersection

This commit is contained in:
Danny Robson 2018-03-27 16:06:34 +11:00
parent 048cffaee7
commit 14e2fc5bd5

View File

@ -84,7 +84,7 @@ namespace util::geom {
// returns the distance along a ray to an aabb
//
// the return value may be negative if the plane lies behind the ray.
// the return value may be NaN in the case the ray and plane are parallel
// the return value may be infinity in the case the ray and plane are parallel
template <size_t S, typename T>
constexpr T
distance (const ray<S,T> r, const aabb<S,T> b)
@ -97,7 +97,7 @@ namespace util::geom {
// did not intersect
if (tmin > tmax)
return std::numeric_limits<T>::quiet_NaN ();
return std::numeric_limits<T>::infinity ();
// closest is behind us
if (tmax < 0)