提交 8b06dfda 编写于 作者: M Mr.doob

Merge pull request #7380 from Mugen87/dev

Put isIntersectionSphere inside a closure
......@@ -247,15 +247,23 @@ THREE.Box3.prototype = {
},
isIntersectionSphere: function ( sphere ) {
isIntersectionSphere: function () {
// Find the point on the AABB closest to the sphere center.
var closestPoint = this.clampPoint( sphere.center );
var closestPoint;
// If that point is inside the sphere, the AABB and sphere intersect.
return closestPoint.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius )
return function isIntersectionSphere( sphere ) {
},
if ( closestPoint === undefined ) closestPoint = new THREE.Vector3();
// Find the point on the AABB closest to the sphere center.
this.clampPoint( sphere.center, closestPoint );
// If that point is inside the sphere, the AABB and sphere intersect.
return closestPoint.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
};
}(),
clampPoint: function ( point, optionalTarget ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册