Pārlūkot izejas kodu

Add isIntersectionSphere to sphere

Tets if two spheres intersect
Oliver Sand 12 gadi atpakaļ
vecāks
revīzija
dcd25863e4
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  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 );