diff --git a/build/Three.js b/build/Three.js index 187ce09cb844e475fe436baf7a1a7d861e3f421f..9961d1032fbd007bb8d8d5181abfb425c343d256 100644 --- a/build/Three.js +++ b/build/Three.js @@ -91,9 +91,9 @@ this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new TH d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;af?-1:1,g.vertexTangents[d]=new THREE.Vector4(Y.x,Y.y,Y.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),g,e;for(g=0,e=this.vertices.length;gf?-1:1,g.vertexTangents[d]=new THREE.Vector4(Y.x,Y.y,Y.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10, +4),g,e;for(g=0,e=this.vertices.length;gthis.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;k=this.points[c[0]];l=this.points[c[1]]; p=this.points[c[2]];n=this.points[c[3]];h=e*e;i=e*h;d.x=b(k.x,l.x,p.x,n.x,e,h,i);d.y=b(k.y,l.y,p.y,n.y,e,h,i);d.z=b(k.z,l.z,p.z,n.z,e,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;ae?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;fe?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10, +4),f,g;for(f=0,g=this.vertices.length;fe?-1:1,f.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;fe?-1:1,f.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10, +4),f,g;for(f=0,g=this.vertices.length;fe?-1:1,f.vertexTangents[d]=new THREE.Vector4(ua.x,ua.y,ua.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;for(f=0,h=this.vertices.length;fe?-1:1,f.vertexTangents[d]=new THREE.Vector4(ua.x,ua.y,ua.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0c.x)c.x=a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10, +4),f,h;for(f=0,h=this.vertices.length;fthis.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];j=this.points[c[1]]; n=this.points[c[2]];p=this.points[c[3]];i=h*h;k=h*i;d.x=b(l.x,j.x,n.x,p.x,h,i,k);d.y=b(l.y,j.y,n.y,p.y,h,i,k);d.z=b(l.z,j.z,n.z,p.z,h,i,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a 0 ) { - - var position, firstPosition = this.vertices[ 0 ].position; + if ( ! this.boundingBox ) { - if ( ! this.boundingBox ) { + this.boundingBox = { min: new THREE.Vector3(), max: new THREE.Vector3() }; - this.boundingBox = { min: firstPosition.clone(), max: firstPosition.clone() }; + } - } else { + if ( this.vertices.length > 0 ) { - this.boundingBox.min.copy( firstPosition ); - this.boundingBox.max.copy( firstPosition ); + var position, firstPosition = this.vertices[ 0 ].position; - } + this.boundingBox.min.copy( firstPosition ); + this.boundingBox.max.copy( firstPosition ); var min = this.boundingBox.min, max = this.boundingBox.max; @@ -395,12 +393,19 @@ THREE.Geometry.prototype = { } + } else { + + this.boundingBox.min.set( 0, 0, 0 ); + this.boundingBox.max.set( 0, 0, 0 ); + } }, computeBoundingSphere: function () { + if ( ! this.boundingSphere ) this.boundingSphere = { radius: 0 }; + var radius, maxRadius = 0; for ( var v = 0, vl = this.vertices.length; v < vl; v ++ ) { @@ -410,7 +415,7 @@ THREE.Geometry.prototype = { } - this.boundingSphere = { radius: maxRadius }; + this.boundingSphere.radius = maxRadius; },