Browse Source

Box3.intersect should ensure that empty intersections result in fully empty boxes

Ben Houston (Clara.io) 9 years ago
parent
commit
2901f76492
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/math/Box3.js

+ 3 - 0
src/math/Box3.js

@@ -385,6 +385,9 @@ THREE.Box3.prototype = {
 		this.min.max( box.min );
 		this.min.max( box.min );
 		this.max.min( box.max );
 		this.max.min( box.max );
 
 
+		// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
+		if( this.isEmpty() ) this.makeEmpty();
+
 		return this;
 		return this;
 
 
 	},
 	},