瀏覽代碼

Add isIntersectionSphere to sphere

Tets if two spheres intersect
Oliver Sand 12 年之前
父節點
當前提交
dcd25863e4
共有 1 個文件被更改,包括 6 次插入0 次删除
  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 );