Kaynağa Gözat

Add isIntersectionSphere to sphere

Tets if two spheres intersect
Oliver Sand 12 yıl önce
ebeveyn
işleme
dcd25863e4
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  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 ) {
 
 		var deltaLengthSq = this.center.distanceToSquared( point );