Browse Source

Improve Box3 closure performance

Tristan VALCKE 8 years ago
parent
commit
7ea7d9db89
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/math/Box3.js

+ 1 - 3
src/math/Box3.js

@@ -300,12 +300,10 @@ Object.assign( Box3.prototype, {
 
 
 	intersectsSphere: ( function () {
 	intersectsSphere: ( function () {
 
 
-		var closestPoint;
+		var closestPoint = new Vector3();
 
 
 		return function intersectsSphere( sphere ) {
 		return function intersectsSphere( sphere ) {
 
 
-			if ( closestPoint === undefined ) closestPoint = new Vector3();
-
 			// Find the point on the AABB closest to the sphere center.
 			// Find the point on the AABB closest to the sphere center.
 			this.clampPoint( sphere.center, closestPoint );
 			this.clampPoint( sphere.center, closestPoint );