Selaa lähdekoodia

Updated builds.

Mr.doob 7 vuotta sitten
vanhempi
commit
fb933b5b97
3 muutettua tiedostoa jossa 27 lisäystä ja 21 poistoa
  1. 8 5
      build/three.js
  2. 11 11
      build/three.min.js
  3. 8 5
      build/three.module.js

+ 8 - 5
build/three.js

@@ -13655,7 +13655,7 @@
 
 
 		intersectsSphere: function ( sphere ) {
 		intersectsSphere: function ( sphere ) {
 
 
-			return this.distanceToPoint( sphere.center ) <= sphere.radius;
+			return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
 
 
 		},
 		},
 
 
@@ -25710,7 +25710,6 @@
 			return function raycast( raycaster, intersects ) {
 			return function raycast( raycaster, intersects ) {
 
 
 				var precision = raycaster.linePrecision;
 				var precision = raycaster.linePrecision;
-				var precisionSq = precision * precision;
 
 
 				var geometry = this.geometry;
 				var geometry = this.geometry;
 				var matrixWorld = this.matrixWorld;
 				var matrixWorld = this.matrixWorld;
@@ -25721,6 +25720,7 @@
 
 
 				sphere.copy( geometry.boundingSphere );
 				sphere.copy( geometry.boundingSphere );
 				sphere.applyMatrix4( matrixWorld );
 				sphere.applyMatrix4( matrixWorld );
+				sphere.radius += precision;
 
 
 				if ( raycaster.ray.intersectsSphere( sphere ) === false ) return;
 				if ( raycaster.ray.intersectsSphere( sphere ) === false ) return;
 
 
@@ -25729,6 +25729,9 @@
 				inverseMatrix.getInverse( matrixWorld );
 				inverseMatrix.getInverse( matrixWorld );
 				ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 				ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 
 
+				var localPrecision = precision / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
+				var localPrecisionSq = localPrecision * localPrecision;
+
 				var vStart = new Vector3();
 				var vStart = new Vector3();
 				var vEnd = new Vector3();
 				var vEnd = new Vector3();
 				var interSegment = new Vector3();
 				var interSegment = new Vector3();
@@ -25755,7 +25758,7 @@
 
 
 							var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 							var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 
 
-							if ( distSq > precisionSq ) continue;
+							if ( distSq > localPrecisionSq ) continue;
 
 
 							interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 							interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 
 
@@ -25787,7 +25790,7 @@
 
 
 							var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 							var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 
 
-							if ( distSq > precisionSq ) continue;
+							if ( distSq > localPrecisionSq ) continue;
 
 
 							interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 							interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 
 
@@ -25821,7 +25824,7 @@
 
 
 						var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );
 						var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );
 
 
-						if ( distSq > precisionSq ) continue;
+						if ( distSq > localPrecisionSq ) continue;
 
 
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 
 

+ 11 - 11
build/three.min.js

@@ -592,7 +592,7 @@ this.morphNormals=a.morphNormals;this.extensions=a.extensions;return this};ta.pr
 lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a=new p;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new p);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},
 lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a=new p;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new p);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},
 distanceSqToPoint:function(){var a=new p;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new p,b=new p,c=new p;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),
 distanceSqToPoint:function(){var a=new p;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new p,b=new p,c=new p;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),
 l=-c.dot(b),n=c.lengthSq(),q=Math.abs(1-k*k);if(0<q){d=k*l-m;e=k*m-l;var p=h*q;0<=d?e>=-p?e<=p?(h=1/q,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-p?(d=Math.max(0,-(-k*h+m)),e=0<d?-h:Math.min(Math.max(-h,-l),h),k=-d*d+e*(e+2*l)+n):e<=p?(d=0,e=Math.min(Math.max(-h,-l),h),k=e*(e+2*l)+n):(d=Math.max(0,-(k*h+m)),e=0<d?h:Math.min(Math.max(-h,-l),h),k=-d*d+e*(e+2*l)+n)}else e=0<k?-h:h,d=Math.max(0,-(k*e+m)),
 l=-c.dot(b),n=c.lengthSq(),q=Math.abs(1-k*k);if(0<q){d=k*l-m;e=k*m-l;var p=h*q;0<=d?e>=-p?e<=p?(h=1/q,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-p?(d=Math.max(0,-(-k*h+m)),e=0<d?-h:Math.min(Math.max(-h,-l),h),k=-d*d+e*(e+2*l)+n):e<=p?(d=0,e=Math.min(Math.max(-h,-l),h),k=e*(e+2*l)+n):(d=Math.max(0,-(k*h+m)),e=0<d?h:Math.min(Math.max(-h,-l),h),k=-d*d+e*(e+2*l)+n)}else e=0<k?-h:h,d=Math.max(0,-(k*e+m)),
-k=-d*d+e*(e+2*l)+n;f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return k}}(),intersectSphere:function(){var a=new p;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d;b=b.radius*b.radius;if(e>b)return null;b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=
+k=-d*d+e*(e+2*l)+n;f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return k}}(),intersectSphere:function(){var a=new p;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d;b=b.radius*b.radius;if(e>b)return null;b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=
 a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*
 a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*
 c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(d<c||c!==c)c=d;0<=e?(h=(a.min.z-f.z)*e,a=(a.max.z-f.z)*e):(h=(a.max.z-f.z)*e,a=(a.min.z-f.z)*e);if(g>a||h>c)return null;if(h>g||g!==g)g=h;if(a<c||c!==c)c=a;return 0>c?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new p;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=
 c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(d<c||c!==c)c=d;0<=e?(h=(a.min.z-f.z)*e,a=(a.max.z-f.z)*e):(h=(a.max.z-f.z)*e,a=(a.min.z-f.z)*e);if(g>a||h>c)return null;if(h>g||g!==g)g=h;if(a<c||c!==c)c=a;return 0>c?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new p;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=
 new p,b=new p,c=new p,d=new p;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},
 new p,b=new p,c=new p,d=new p;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},
@@ -637,16 +637,16 @@ this.skeleton.calculateInverses(),b=this.matrixWorld);this.bindMatrix.copy(b);th
 0;a<d.count;a++)b.x=d.getX(a),b.y=d.getY(a),b.z=d.getZ(a),b.w=d.getW(a),c=1/b.manhattanLength(),Infinity!==c?b.multiplyScalar(c):b.set(1,0,0,0),d.setXYZW(a,b.x,b.y,b.z,b.w)}},updateMatrixWorld:function(a){la.prototype.updateMatrixWorld.call(this,a);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return(new this.constructor(this.geometry,
 0;a<d.count;a++)b.x=d.getX(a),b.y=d.getY(a),b.z=d.getZ(a),b.w=d.getW(a),c=1/b.manhattanLength(),Infinity!==c?b.multiplyScalar(c):b.set(1,0,0,0),d.setXYZW(a,b.x,b.y,b.z,b.w)}},updateMatrixWorld:function(a){la.prototype.updateMatrixWorld.call(this,a);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return(new this.constructor(this.geometry,
 this.material)).copy(this)}});X.prototype=Object.create(I.prototype);X.prototype.constructor=X;X.prototype.isLineBasicMaterial=!0;X.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.linecap=a.linecap;this.linejoin=a.linejoin;return this};sa.prototype=Object.assign(Object.create(D.prototype),{constructor:sa,isLine:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===
 this.material)).copy(this)}});X.prototype=Object.create(I.prototype);X.prototype.constructor=X;X.prototype.isLineBasicMaterial=!0;X.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.linecap=a.linecap;this.linejoin=a.linejoin;return this};sa.prototype=Object.assign(Object.create(D.prototype),{constructor:sa,isLine:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===
 c.index){for(var d=c.attributes.position,e=[0],f=1,g=d.count;f<g;f++)a.fromBufferAttribute(d,f-1),b.fromBufferAttribute(d,f),e[f]=e[f-1],e[f]+=a.distanceTo(b);c.addAttribute("lineDistance",new A(e,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(c.isGeometry)for(d=c.vertices,e=c.lineDistances,e[0]=0,f=1,g=d.length;f<g;f++)e[f]=e[f-1],e[f]+=d[f-1].distanceTo(d[f]);return this}}(),raycast:function(){var a=new S,b=new nb,c=
 c.index){for(var d=c.attributes.position,e=[0],f=1,g=d.count;f<g;f++)a.fromBufferAttribute(d,f-1),b.fromBufferAttribute(d,f),e[f]=e[f-1],e[f]+=a.distanceTo(b);c.addAttribute("lineDistance",new A(e,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(c.isGeometry)for(d=c.vertices,e=c.lineDistances,e[0]=0,f=1,g=d.length;f<g;f++)e[f]=e[f-1],e[f]+=d[f-1].distanceTo(d[f]);return this}}(),raycast:function(){var a=new S,b=new nb,c=
-new Da;return function(d,e){var f=d.linePrecision;f*=f;var g=this.geometry,h=this.matrixWorld;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(h);if(!1!==d.ray.intersectsSphere(c)){a.getInverse(h);b.copy(d.ray).applyMatrix4(a);var k=new p,m=new p;h=new p;var l=new p,n=this&&this.isLineSegments?2:1;if(g.isBufferGeometry){var q=g.index,u=g.attributes.position.array;if(null!==q){q=q.array;g=0;for(var t=q.length-1;g<t;g+=n){var w=q[g+1];k.fromArray(u,3*q[g]);
-m.fromArray(u,3*w);w=b.distanceSqToSegment(k,m,l,h);w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,t=u.length/3-1;g<t;g+=n)k.fromArray(u,3*g),m.fromArray(u,3*g+3),w=b.distanceSqToSegment(k,m,l,h),w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),
-index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(k=g.vertices,m=k.length,g=0;g<m-1;g+=n)w=b.distanceSqToSegment(k[g],k[g+1],l,h),w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});T.prototype=Object.assign(Object.create(sa.prototype),
-{constructor:T,isLineSegments:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;f<g;f+=2)a.fromBufferAttribute(d,f),b.fromBufferAttribute(d,f+1),e[f]=0===f?0:e[f-1],e[f+1]=e[f]+a.distanceTo(b);c.addAttribute("lineDistance",new A(e,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(c.isGeometry)for(d=
-c.vertices,e=c.lineDistances,f=0,g=d.length;f<g;f+=2)a.copy(d[f]),b.copy(d[f+1]),e[f]=0===f?0:e[f-1],e[f+1]=e[f]+a.distanceTo(b);return this}}()});ud.prototype=Object.assign(Object.create(sa.prototype),{constructor:ud,isLineLoop:!0});Ea.prototype=Object.create(I.prototype);Ea.prototype.constructor=Ea;Ea.prototype.isPointsMaterial=!0;Ea.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;this.morphTargets=
-a.morphTargets;return this};Pb.prototype=Object.assign(Object.create(D.prototype),{constructor:Pb,isPoints:!0,raycast:function(){var a=new S,b=new nb,c=new Da;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);f<l&&(b.closestPointToPoint(a,n),n.applyMatrix4(k),a=d.ray.origin.distanceTo(n),a<d.near||a>d.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:n.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&
-h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new p;var n=new p;if(h.isBufferGeometry){var q=h.index;h=h.attributes.position.array;if(null!==q){var u=q.array;q=0;for(var t=u.length;q<t;q++){var w=u[q];m.fromArray(h,3*w);f(m,w)}}else for(q=0,u=h.length/3;q<u;q++)m.fromArray(h,3*q),f(m,q)}else for(m=h.vertices,q=0,u=m.length;q<
-u;q++)f(m[q],q)}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});$d.prototype=Object.assign(Object.create(W.prototype),{constructor:$d,isVideoTexture:!0,update:function(){var a=this.image;a.readyState>=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Qb.prototype=Object.create(W.prototype);Qb.prototype.constructor=Qb;Qb.prototype.isCompressedTexture=!0;Ec.prototype=Object.create(W.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isCanvasTexture=!0;Fc.prototype=
-Object.create(W.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDepthTexture=!0;Rb.prototype=Object.create(B.prototype);Rb.prototype.constructor=Rb;Gc.prototype=Object.create(K.prototype);Gc.prototype.constructor=Gc;Sb.prototype=Object.create(B.prototype);Sb.prototype.constructor=Sb;Hc.prototype=Object.create(K.prototype);Hc.prototype.constructor=Hc;na.prototype=Object.create(B.prototype);na.prototype.constructor=na;Ic.prototype=Object.create(K.prototype);Ic.prototype.constructor=Ic;Tb.prototype=
-Object.create(na.prototype);Tb.prototype.constructor=Tb;Jc.prototype=Object.create(K.prototype);Jc.prototype.constructor=Jc;qb.prototype=Object.create(na.prototype);qb.prototype.constructor=qb;Kc.prototype=Object.create(K.prototype);Kc.prototype.constructor=Kc;Ub.prototype=Object.create(na.prototype);Ub.prototype.constructor=Ub;Lc.prototype=Object.create(K.prototype);Lc.prototype.constructor=Lc;Vb.prototype=Object.create(na.prototype);Vb.prototype.constructor=Vb;Mc.prototype=Object.create(K.prototype);
+new Da;return function(d,e){var f=d.linePrecision,g=this.geometry,h=this.matrixWorld;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(h);c.radius+=f;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(h);b.copy(d.ray).applyMatrix4(a);f/=(this.scale.x+this.scale.y+this.scale.z)/3;f*=f;var k=new p,m=new p;h=new p;var l=new p,n=this&&this.isLineSegments?2:1;if(g.isBufferGeometry){var q=g.index,u=g.attributes.position.array;if(null!==q){q=q.array;g=0;for(var t=q.length-
+1;g<t;g+=n){var w=q[g+1];k.fromArray(u,3*q[g]);m.fromArray(u,3*w);w=b.distanceSqToSegment(k,m,l,h);w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,t=u.length/3-1;g<t;g+=n)k.fromArray(u,3*g),m.fromArray(u,3*g+3),w=b.distanceSqToSegment(k,m,l,h),w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,
+point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(k=g.vertices,m=k.length,g=0;g<m-1;g+=n)w=b.distanceSqToSegment(k[g],k[g+1],l,h),w>f||(l.applyMatrix4(this.matrixWorld),w=d.ray.origin.distanceTo(l),w<d.near||w>d.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});T.prototype=
+Object.assign(Object.create(sa.prototype),{constructor:T,isLineSegments:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;f<g;f+=2)a.fromBufferAttribute(d,f),b.fromBufferAttribute(d,f+1),e[f]=0===f?0:e[f-1],e[f+1]=e[f]+a.distanceTo(b);c.addAttribute("lineDistance",new A(e,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
+else if(c.isGeometry)for(d=c.vertices,e=c.lineDistances,f=0,g=d.length;f<g;f+=2)a.copy(d[f]),b.copy(d[f+1]),e[f]=0===f?0:e[f-1],e[f+1]=e[f]+a.distanceTo(b);return this}}()});ud.prototype=Object.assign(Object.create(sa.prototype),{constructor:ud,isLineLoop:!0});Ea.prototype=Object.create(I.prototype);Ea.prototype.constructor=Ea;Ea.prototype.isPointsMaterial=!0;Ea.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;
+this.morphTargets=a.morphTargets;return this};Pb.prototype=Object.assign(Object.create(D.prototype),{constructor:Pb,isPoints:!0,raycast:function(){var a=new S,b=new nb,c=new Da;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);f<l&&(b.closestPointToPoint(a,n),n.applyMatrix4(k),a=d.ray.origin.distanceTo(n),a<d.near||a>d.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:n.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;
+null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new p;var n=new p;if(h.isBufferGeometry){var q=h.index;h=h.attributes.position.array;if(null!==q){var u=q.array;q=0;for(var t=u.length;q<t;q++){var w=u[q];m.fromArray(h,3*w);f(m,w)}}else for(q=0,u=h.length/3;q<u;q++)m.fromArray(h,3*q),f(m,q)}else for(m=h.vertices,
+q=0,u=m.length;q<u;q++)f(m[q],q)}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});$d.prototype=Object.assign(Object.create(W.prototype),{constructor:$d,isVideoTexture:!0,update:function(){var a=this.image;a.readyState>=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Qb.prototype=Object.create(W.prototype);Qb.prototype.constructor=Qb;Qb.prototype.isCompressedTexture=!0;Ec.prototype=Object.create(W.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isCanvasTexture=
+!0;Fc.prototype=Object.create(W.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDepthTexture=!0;Rb.prototype=Object.create(B.prototype);Rb.prototype.constructor=Rb;Gc.prototype=Object.create(K.prototype);Gc.prototype.constructor=Gc;Sb.prototype=Object.create(B.prototype);Sb.prototype.constructor=Sb;Hc.prototype=Object.create(K.prototype);Hc.prototype.constructor=Hc;na.prototype=Object.create(B.prototype);na.prototype.constructor=na;Ic.prototype=Object.create(K.prototype);Ic.prototype.constructor=
+Ic;Tb.prototype=Object.create(na.prototype);Tb.prototype.constructor=Tb;Jc.prototype=Object.create(K.prototype);Jc.prototype.constructor=Jc;qb.prototype=Object.create(na.prototype);qb.prototype.constructor=qb;Kc.prototype=Object.create(K.prototype);Kc.prototype.constructor=Kc;Ub.prototype=Object.create(na.prototype);Ub.prototype.constructor=Ub;Lc.prototype=Object.create(K.prototype);Lc.prototype.constructor=Lc;Vb.prototype=Object.create(na.prototype);Vb.prototype.constructor=Vb;Mc.prototype=Object.create(K.prototype);
 Mc.prototype.constructor=Mc;Wb.prototype=Object.create(B.prototype);Wb.prototype.constructor=Wb;Nc.prototype=Object.create(K.prototype);Nc.prototype.constructor=Nc;Xb.prototype=Object.create(B.prototype);Xb.prototype.constructor=Xb;Oc.prototype=Object.create(K.prototype);Oc.prototype.constructor=Oc;Yb.prototype=Object.create(B.prototype);Yb.prototype.constructor=Yb;var Ug={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=bf(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var k=
 Mc.prototype.constructor=Mc;Wb.prototype=Object.create(B.prototype);Wb.prototype.constructor=Wb;Nc.prototype=Object.create(K.prototype);Nc.prototype.constructor=Nc;Xb.prototype=Object.create(B.prototype);Xb.prototype.constructor=Xb;Oc.prototype=Object.create(K.prototype);Oc.prototype.constructor=Oc;Yb.prototype=Object.create(B.prototype);Yb.prototype.constructor=Yb;var Ug={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=bf(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var k=
 c;d=[];var m;var l=0;for(m=b.length;l<m;l++){var n=b[l]*k;var q=l<m-1?b[l+1]*k:a.length;n=bf(a,n,q,k,!1);n===n.next&&(n.steiner=!0);d.push(Pg(n))}d.sort(Ng);for(l=0;l<d.length;l++){b=d[l];k=f;if(k=Og(b,k))b=ef(k,b),Qc(b,b.next);f=Qc(f,f.next)}}if(a.length>80*c){var p=h=a[0];var t=d=a[1];for(k=c;k<e;k+=c)l=a[k],b=a[k+1],l<p&&(p=l),b<t&&(t=b),l>h&&(h=l),b>d&&(d=b);h=Math.max(h-p,d-t);h=0!==h?1/h:0}Rc(f,g,c,p,t,h);return g}},Wa={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-
 c;d=[];var m;var l=0;for(m=b.length;l<m;l++){var n=b[l]*k;var q=l<m-1?b[l+1]*k:a.length;n=bf(a,n,q,k,!1);n===n.next&&(n.steiner=!0);d.push(Pg(n))}d.sort(Ng);for(l=0;l<d.length;l++){b=d[l];k=f;if(k=Og(b,k))b=ef(k,b),Qc(b,b.next);f=Qc(f,f.next)}}if(a.length>80*c){var p=h=a[0];var t=d=a[1];for(k=c;k<e;k+=c)l=a[k],b=a[k+1],l<p&&(p=l),b<t&&(t=b),l>h&&(h=l),b>d&&(d=b);h=Math.max(h-p,d-t);h=0!==h?1/h:0}Rc(f,g,c,p,t,h);return g}},Wa={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-
 a[e].x*a[d].y;return.5*c},isClockWise:function(a){return 0>Wa.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];ff(a);gf(c,a);var f=a.length;b.forEach(ff);for(a=0;a<b.length;a++)d.push(f),f+=b[a].length,gf(c,b[a]);b=Ug.triangulate(c,d);for(a=0;a<b.length;a+=3)e.push(b.slice(a,a+3));return e}};sb.prototype=Object.create(K.prototype);sb.prototype.constructor=sb;sb.prototype.toJSON=function(){var a=K.prototype.toJSON.call(this);return hf(this.parameters.shapes,this.parameters.options,a)};Pa.prototype=
 a[e].x*a[d].y;return.5*c},isClockWise:function(a){return 0>Wa.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];ff(a);gf(c,a);var f=a.length;b.forEach(ff);for(a=0;a<b.length;a++)d.push(f),f+=b[a].length,gf(c,b[a]);b=Ug.triangulate(c,d);for(a=0;a<b.length;a+=3)e.push(b.slice(a,a+3));return e}};sb.prototype=Object.create(K.prototype);sb.prototype.constructor=sb;sb.prototype.toJSON=function(){var a=K.prototype.toJSON.call(this);return hf(this.parameters.shapes,this.parameters.options,a)};Pa.prototype=

+ 8 - 5
build/three.module.js

@@ -13649,7 +13649,7 @@ Object.assign( Ray.prototype, {
 
 
 	intersectsSphere: function ( sphere ) {
 	intersectsSphere: function ( sphere ) {
 
 
-		return this.distanceToPoint( sphere.center ) <= sphere.radius;
+		return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
 
 
 	},
 	},
 
 
@@ -25704,7 +25704,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 		return function raycast( raycaster, intersects ) {
 		return function raycast( raycaster, intersects ) {
 
 
 			var precision = raycaster.linePrecision;
 			var precision = raycaster.linePrecision;
-			var precisionSq = precision * precision;
 
 
 			var geometry = this.geometry;
 			var geometry = this.geometry;
 			var matrixWorld = this.matrixWorld;
 			var matrixWorld = this.matrixWorld;
@@ -25715,6 +25714,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 
 			sphere.copy( geometry.boundingSphere );
 			sphere.copy( geometry.boundingSphere );
 			sphere.applyMatrix4( matrixWorld );
 			sphere.applyMatrix4( matrixWorld );
+			sphere.radius += precision;
 
 
 			if ( raycaster.ray.intersectsSphere( sphere ) === false ) return;
 			if ( raycaster.ray.intersectsSphere( sphere ) === false ) return;
 
 
@@ -25723,6 +25723,9 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 			inverseMatrix.getInverse( matrixWorld );
 			inverseMatrix.getInverse( matrixWorld );
 			ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 			ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 
 
+			var localPrecision = precision / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
+			var localPrecisionSq = localPrecision * localPrecision;
+
 			var vStart = new Vector3();
 			var vStart = new Vector3();
 			var vEnd = new Vector3();
 			var vEnd = new Vector3();
 			var interSegment = new Vector3();
 			var interSegment = new Vector3();
@@ -25749,7 +25752,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 
 						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 
 
-						if ( distSq > precisionSq ) continue;
+						if ( distSq > localPrecisionSq ) continue;
 
 
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 
 
@@ -25781,7 +25784,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 
 						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 						var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );
 
 
-						if ( distSq > precisionSq ) continue;
+						if ( distSq > localPrecisionSq ) continue;
 
 
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 						interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 
 
@@ -25815,7 +25818,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 
 					var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );
 					var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );
 
 
-					if ( distSq > precisionSq ) continue;
+					if ( distSq > localPrecisionSq ) continue;
 
 
 					interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation
 					interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation