geom/ray: use infinity, not nan, to signal no intersection
This commit is contained in:
parent
048cffaee7
commit
14e2fc5bd5
@ -84,7 +84,7 @@ namespace util::geom {
|
|||||||
// returns the distance along a ray to an aabb
|
// 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 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>
|
template <size_t S, typename T>
|
||||||
constexpr T
|
constexpr T
|
||||||
distance (const ray<S,T> r, const aabb<S,T> b)
|
distance (const ray<S,T> r, const aabb<S,T> b)
|
||||||
@ -97,7 +97,7 @@ namespace util::geom {
|
|||||||
|
|
||||||
// did not intersect
|
// did not intersect
|
||||||
if (tmin > tmax)
|
if (tmin > tmax)
|
||||||
return std::numeric_limits<T>::quiet_NaN ();
|
return std::numeric_limits<T>::infinity ();
|
||||||
|
|
||||||
// closest is behind us
|
// closest is behind us
|
||||||
if (tmax < 0)
|
if (tmax < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user