Browse Source

Add isIntersectionSphere to sphere

Tets if two spheres intersect
Oliver Sand 12 years ago
parent
commit
dcd25863e4
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/math/Sphere.js

+ 6 - 0
src/math/Sphere.js

@@ -67,6 +67,12 @@ THREE.Sphere.prototype = {
 
 
 	},
 	},
 
 
+	isIntersectionSphere: function(sphere) {
+
+		return ( sphere.center.distanceToSquared( this.center ) <= ( this.radius * this.radius + sphere.radius * sphere.radius) );
+		
+	},
+
 	clampPoint: function ( point, optionalTarget ) {
 	clampPoint: function ( point, optionalTarget ) {
 
 
 		var deltaLengthSq = this.center.distanceToSquared( point );
 		var deltaLengthSq = this.center.distanceToSquared( point );