Browse Source

Ray: Improve readabilty in intersectBox(). (#24790)

Michael Herzog 2 years ago
parent
commit
796d1cfbd3
1 changed files with 2 additions and 5 deletions
  1. 2 5
      src/math/Ray.js

+ 2 - 5
src/math/Ray.js

@@ -356,12 +356,9 @@ class Ray {
 
 		if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;
 
-		// These lines also handle the case where tmin or tmax is NaN
-		// (result of 0 * Infinity). x !== x returns true if x is NaN
+		if ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;
 
-		if ( tymin > tmin || tmin !== tmin ) tmin = tymin;
-
-		if ( tymax < tmax || tmax !== tmax ) tmax = tymax;
+		if ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;
 
 		if ( invdirz >= 0 ) {