Browse Source

Some more code cleanup.

alteredq 12 years ago
parent
commit
e801b91110
10 changed files with 175 additions and 708 deletions
  1. 0 631
      build/three.js
  2. 16 16
      build/three.min.js
  3. 11 4
      src/core/Box2.js
  4. 9 7
      src/core/Box3.js
  5. 5 2
      src/core/Frustum.js
  6. 8 0
      src/core/Plane.js
  7. 1 1
      src/core/Sphere.js
  8. 28 11
      src/core/Vector2.js
  9. 41 15
      src/core/Vector3.js
  10. 56 21
      src/core/Vector4.js

File diff suppressed because it is too large
+ 0 - 631
build/three.js


+ 16 - 16
build/three.min.js

@@ -19,10 +19,10 @@ grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:491533
 lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,
 palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,
 tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=
-a;this.y*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},minSelf:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},maxSelf:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clampSelf:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*
-this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},clone:function(){return new THREE.Vector2(this.x,
-this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=
+a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},minSelf:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},maxSelf:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clampSelf:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*
+a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===
+this.x&&a.y===this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},minSelf:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},maxSelf:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clampSelf:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*
@@ -33,18 +33,18 @@ return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.
 d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+
 a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-
 e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;
-this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},minSelf:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>
-a.w&&(this.w=a.w);return this},maxSelf:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clampSelf:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*
-a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===
-this.y&&a.z===this.z&&a.w===this.w},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+
-g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=
-(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};THREE.Box2=function(a,b){void 0==a&&void 0===b?(this.min=new THREE.Vector2,this.max=new THREE.Vector2,this.makeEmpty()):(this.min=a||new THREE.Vector2,this.max=b||(new THREE.Vector2).copy(this.min))};
+THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+
+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},minSelf:function(a){this.x>
+a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},maxSelf:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clampSelf:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},
+dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*
+b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-
+g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));
+0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};THREE.Box2=function(a,b){void 0===a&&void 0===b?(this.min=new THREE.Vector2,this.max=new THREE.Vector2,this.makeEmpty()):(this.min=a||new THREE.Vector2,this.max=b||(new THREE.Vector2).copy(this.min))};
 THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min=a;this.max=b;return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(a,b){var c=THREE.Box2.__v1.copy(b).multiplyScalar(0.5);this.min.copy(a).subSelf(c);this.max.copy(a).addSelf(c);
 return this},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},volume:function(){return(this.max.x-this.min.x)*(this.max.y-this.min.y)},center:function(){return(new THREE.Vector2).add(this.min,this.max).multiplyScalar(0.5)},size:function(){return(new THREE.Vector2).sub(this.max,this.min)},expandByPoint:function(a){this.min.minSelf(a);
 this.max.maxSelf(a);return this},expandByVector:function(a){this.min.subSelf(a);this.max.addSelf(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return this.min.x<=a.x&&a.x<=this.max.x&&this.min.y<=a.y&&a.y<=this.max.y?!0:!1},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a){return new THREE.Vector2((a.x-this.min.x)/(this.max.x-
 this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersection:function(a){return this.max.x<a.min.x||a.min.x>this.max.x||this.max.y<a.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a){return(new THREE.Vector2).copy(a).clampSelf(this.min,this.max)},distanceToPoint:function(a){return this.clampPoint(a).subSelf(a).length()},intersect:function(a){this.min.maxSelf(a.min);this.max.minSelf(a.max);return this},union:function(a){this.min.minSelf(a.min);this.max.maxSelf(a.max);return this},translate:function(a){this.min.addSelf(a);
-this.max.addSelf(a);return this},scale:function(a){a=this.size().multiplyScalar(0.5*(1-a));this.expandByVector(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box2.__v1=new THREE.Vector2;THREE.Box3=function(a,b){void 0==a&&void 0===b?(this.min=new THREE.Vector3,this.max=new THREE.Vector3,this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-Infinity,console.log(this)):(this.min=a||new THREE.Vector3,this.max=b||(new THREE.Vector3).copy(this.min))};
+this.max.addSelf(a);return this},scale:function(a){a=this.size().multiplyScalar(0.5*(1-a));this.expandByVector(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box2.__v1=new THREE.Vector2;THREE.Box3=function(a,b){void 0===a&&void 0===b?(this.min=new THREE.Vector3,this.max=new THREE.Vector3,this.makeEmpty()):(this.min=a||new THREE.Vector3,this.max=b||(new THREE.Vector3).copy(this.min))};
 THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min=a;this.max=b;return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y),b.z<this.min.z?this.min.z=b.z:b.z>this.max.z&&(this.max.z=b.z)}else this.makeEmpty();return this},setFromCenterAndSize:function(a,b){var c=THREE.Box3.__v1.copy(b).multiplyScalar(0.5);
 this.min.copy(a).subSelf(c);this.max.copy(a).addSelf(c);return this},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},volume:function(){return(this.max.x-this.min.x)*(this.max.y-this.min.y)*(this.max.z-this.min.z)},center:function(){return(new THREE.Vector3).add(this.min,
 this.max).multiplyScalar(0.5)},size:function(){return(new THREE.Vector3).sub(this.max,this.min)},expandByPoint:function(a){this.min.minSelf(a);this.max.maxSelf(a);return this},expandByVector:function(a){this.min.subSelf(a);this.max.addSelf(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return this.min.x<=a.x&&a.x<=this.max.x&&this.min.y<=a.y&&a.y<=this.max.y&&this.min.z<=a.z&&a.z<=this.max.z?!0:!1},containsBox:function(a){return this.min.x<=
@@ -78,10 +78,10 @@ this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a
 b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/
 h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c)for(var d=0,e=c.length;d<e;d++)c[d](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Plane,new THREE.Plane,new THREE.Plane,new THREE.Plane,new THREE.Plane,new THREE.Plane]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],p=c[9],n=c[10],r=c[11],q=c[12],m=c[13],t=c[14],c=c[15];b[0].setComponents(f-a,j-g,r-l,c-q);b[1].setComponents(f+a,j+g,r+l,c+q);b[2].setComponents(f+d,j+h,r+p,c+m);b[3].setComponents(f-d,j-h,r-p,c-m);b[4].setComponents(f-e,j-i,r-n,c-t);b[5].setComponents(f+e,j+i,r+n,c+t);for(a=0;6>a;a++)b[a].normalize()};
-THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.getPosition(),a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;6>e;e++)if(b=c[e].distanceToPoint(d),b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;THREE.Plane=function(a,b){this.normal=a||new THREE.Vector3;this.constant=b||0};
-THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal=a;this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal=a;this.constant=-b.dot(a);return this},setFromCoplanarPoints:function(a,b,c){b=THREE.Plane3.__v1.sub(b,a).cross(THREE.Plane3.__v2.sub(c,a));this.setFromNormalAndCoplanarPoint(b,a);return this},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;
+THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.getPosition(),a=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=c=0;6>e;e++)if(c=b[e].distanceToPoint(d),c<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;THREE.Plane=function(a,b){this.normal=a||new THREE.Vector3;this.constant=b||0};
+THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal=a;this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal=a;this.constant=-b.dot(a);return this},setFromCoplanarPoints:function(a,b,c){b=THREE.Plane.__v1.sub(b,a).cross(THREE.Plane.__v2.sub(c,a));this.setFromNormalAndCoplanarPoint(b,a);return this},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;
 return this},flip:function(){this.normal.negate();return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a){return this.orthoPoint(a).subSelf(a).negate()},orthoPoint:function(a){a=this.distanceToPoint(a);return(new THREE.Vector3).copy(this.normal).multiplyScalar(a)},
-intersectsLine:function(a,b){var c=this.distanceToPoint(a),d=this.distanceToPoint(b);return 0>c&&0<d||0>d&&0<c},coplanarPoint:function(){return(new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},translate:function(a){this.constant=-a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant==this.constant},clone:function(){return(new THREE.Plane3).copy(this)}};THREE.Plane.__v1=new THREE.Vector3;THREE.Plane.__v2=new THREE.Vector3;(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,l=new a.Vector3,p=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,l.copy(b).multiplyScalar(d));return c.distanceTo(a)},n=function(a,b,c,d){i.sub(d,b);j.sub(c,b);l.sub(a,
+intersectsLine:function(a,b){var c=this.distanceToPoint(a),d=this.distanceToPoint(b);return 0>c&&0<d||0>d&&0<c},coplanarPoint:function(){return(new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},translate:function(a){this.constant=-a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Plane.__v1=new THREE.Vector3;THREE.Plane.__v2=new THREE.Vector3;(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,l=new a.Vector3,p=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,l.copy(b).multiplyScalar(d));return c.distanceTo(a)},n=function(a,b,c,d){i.sub(d,b);j.sub(c,b);l.sub(a,
 b);var a=i.dot(i),b=i.dot(j),c=i.dot(l),e=j.dot(j),d=j.dot(l),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return 0<=e&&0<=a&&1>e+a},r=function(h,i,j){if(h instanceof a.Particle){var l=p(i.origin,i.direction,h.matrixWorld.getPosition());if(l>h.scale.x)return j;j.push({distance:l,point:h.position,face:null,object:h})}else if(h instanceof a.Mesh){var r=h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis(),l=p(i.origin,i.direction,h.matrixWorld.getPosition());if(l>r)return j;var r=h.geometry,
 q=r.vertices,F=h.material instanceof a.MeshFaceMaterial,A=!0===F?h.material.materials:null,l=h.material.side,w,v,I,C=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var H=0,M=r.faces.length;H<M;H++){var z=r.faces[H],l=!0===F?A[z.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(z.centroid,c),v=z.normal,w=d.dot(v),!(Math.abs(w)<C)&&(v=v.dot(e)/w,!(0>
 v)&&(l===a.DoubleSide||(l===a.FrontSide?0>w:0<w)))))if(f.add(c,d.multiplyScalar(v)),z instanceof a.Face3)l=q[z.a],w=q[z.b],v=q[z.c],n(f,l,w,v)&&(w=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(w),l<i.near||l>i.far||j.push({distance:l,point:w,face:z,faceIndex:H,object:h}));else if(z instanceof a.Face4&&(l=q[z.a],w=q[z.b],v=q[z.c],I=q[z.d],n(f,l,w,I)||n(f,w,v,I)))w=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(w),l<i.near||l>i.far||j.push({distance:l,point:w,face:z,faceIndex:H,object:h})}}},
@@ -90,7 +90,7 @@ g?e:g);a()};this.add3Points=function(f,g,l,p,n,r){!0===h?(h=!1,b=f<l?f<n?f:n:l<n
 d=d>f.getRight()?d:f.getRight(),e=e>f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Sphere=function(a,b){this.center=a||new THREE.Vector3;this.radius=b||0};
 THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center=a;this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},volume:function(){return 4*Math.PI/3*this.radius*this.radius*this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=
 this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},clampPoint:function(a){var b=this.center.distanceToSquared(a),a=(new THREE.Vector3).copy(a);b>this.radius*this.radius&&(a.subSelf(this.center).normalize(),a.multiplyScalar(this.radius).addSelf(this.center));return a},bounds:function(){var a=new THREE.Box3(this.center,this.center);a.expandByScalar(this.radius);return a},translate:function(){this.center.addSelf(this.offset);return this},scale:function(a){this.radius*=
-a;return this},equals:function(a){return a.center.equals(this.center)&&a.radius==this.radius},clone:function(){return(new THREE.Sphere3).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Object3D=function(){THREE.Object3DLibrary.push(this);this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=
+a;return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere3).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Object3D=function(){THREE.Object3DLibrary.push(this);this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=
 this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
 this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))},add:function(a){if(a===

+ 11 - 4
src/core/Box2.js

@@ -4,7 +4,7 @@
 
 THREE.Box2 = function ( min, max ) {
 
-	if ( min == undefined && max === undefined ) {
+	if ( min === undefined && max === undefined ) {
 
 		this.min = new THREE.Vector2();
 		this.max = new THREE.Vector2();
@@ -107,6 +107,7 @@ THREE.Box2.prototype = {
 	empty: function () {
 
 		// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
+
 		return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );
 
 	},
@@ -156,7 +157,7 @@ THREE.Box2.prototype = {
 	containsPoint: function ( point ) {
 
 		if ( ( this.min.x <= point.x ) && ( point.x <= this.max.x ) &&
-			( this.min.y <= point.y ) && ( point.y <= this.max.y ) ) {
+			 ( this.min.y <= point.y ) && ( point.y <= this.max.y ) ) {
 
 			return true;
 
@@ -169,7 +170,7 @@ THREE.Box2.prototype = {
 	containsBox: function ( box ) {
 
 		if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&
-			( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) {
+			 ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) {
 
 			return true;
 
@@ -180,24 +181,30 @@ THREE.Box2.prototype = {
 	},
 
 	getParameter: function ( point ) {
+
 		// This can potentially have a divide by zero if the box
 		// has a size dimension of 0.
+
 		return new THREE.Vector2(
 			( point.x - this.min.x ) / ( this.max.x - this.min.x ),
 			( point.y - this.min.y ) / ( this.max.y - this.min.y )
 		);
+
 	},
 
 	isIntersection: function ( box ) {
+
 		// using 6 splitting planes to rule out intersections.
+
 		if ( ( this.max.x < box.min.x ) || ( box.min.x > this.max.x ) ||
-			( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ) {
+			 ( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ) {
 
 			return false;
 
 		}
 
 		return true;
+
 	},
 
 	clampPoint: function ( point ) {

+ 9 - 7
src/core/Box3.js

@@ -4,7 +4,7 @@
 
 THREE.Box3 = function ( min, max ) {
 
-	if( min == undefined && max === undefined ) {
+	if ( min === undefined && max === undefined ) {
 
 		this.min = new THREE.Vector3();
 		this.max = new THREE.Vector3();
@@ -84,6 +84,7 @@ THREE.Box3.prototype = {
 		}
 
 		return this;
+
 	},
 
 	setFromCenterAndSize: function ( center, size ) {
@@ -118,6 +119,7 @@ THREE.Box3.prototype = {
 	empty: function () {
 
 		// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
+
 		return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );
 
 	},
@@ -170,8 +172,8 @@ THREE.Box3.prototype = {
 	containsPoint: function ( point ) {
 
 		if ( ( this.min.x <= point.x ) && ( point.x <= this.max.x ) &&
-			( this.min.y <= point.y ) && ( point.y <= this.max.y ) &&
-			( this.min.z <= point.z ) && ( point.z <= this.max.z ) ) {
+			 ( this.min.y <= point.y ) && ( point.y <= this.max.y ) &&
+			 ( this.min.z <= point.z ) && ( point.z <= this.max.z ) ) {
 
 			return true;
 
@@ -184,8 +186,8 @@ THREE.Box3.prototype = {
 	containsBox: function ( box ) {
 
 		if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&
-			( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) &&
-			( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) {
+			 ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) &&
+			 ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) {
 
 			return true;
 
@@ -212,8 +214,8 @@ THREE.Box3.prototype = {
 		// using 6 splitting planes to rule out intersections.
 
 		if ( ( this.max.x < box.min.x ) || ( box.min.x > this.max.x ) ||
-			( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ||
-			( this.max.z < box.min.z ) || ( box.min.z > this.max.z ) ) {
+			 ( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ||
+			 ( this.max.z < box.min.z ) || ( box.min.z > this.max.z ) ) {
 
 			return false;
 

+ 5 - 2
src/core/Frustum.js

@@ -21,7 +21,6 @@ THREE.Frustum = function ( ) {
 
 THREE.Frustum.prototype.setFromMatrix = function ( m ) {
 
-	var plane;
 	var planes = this.planes;
 
 	var me = m.elements;
@@ -38,19 +37,23 @@ THREE.Frustum.prototype.setFromMatrix = function ( m ) {
 	planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 );
 
 	for ( var i = 0; i < 6; i ++ ) {
+
 		planes[ i ].normalize();
+
 	}
 
 };
 
 THREE.Frustum.prototype.contains = function ( object ) {
 
-	var distance = 0.0;
 	var planes = this.planes;
+
 	var matrix = object.matrixWorld;
 	var matrixPosition = matrix.getPosition();
 	var radius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
 
+	var distance = 0.0;
+
 	for ( var i = 0; i < 6; i ++ ) {
 
 		distance = planes[ i ].distanceToPoint( matrixPosition );

+ 8 - 0
src/core/Plane.js

@@ -19,6 +19,7 @@ THREE.Plane.prototype = {
 		this.constant = constant;
 
 		return this;
+
 	},
 
 	setComponents: function ( x, y, z, w ) {
@@ -27,6 +28,7 @@ THREE.Plane.prototype = {
 		this.constant = w;
 
 		return this;
+
 	},
 
 	setFromNormalAndCoplanarPoint: function ( normal, point ) {
@@ -35,6 +37,7 @@ THREE.Plane.prototype = {
 		this.constant = - point.dot( normal );
 
 		return this;
+
 	},
 
 	setFromCoplanarPoints: function ( a, b, c ) {
@@ -69,6 +72,7 @@ THREE.Plane.prototype = {
 	normalize: function () {
 
 		// Note: will lead to a divide by zero if the plane is invalid.
+
 		var inverseNormalLength = 1.0 / this.normal.length();
 		this.normal.multiplyScalar( inverseNormalLength );
 		this.constant *= inverseNormalLength;
@@ -80,11 +84,13 @@ THREE.Plane.prototype = {
 	distanceToPoint: function ( point ) {
 
 		return this.normal.dot( point ) + this.constant;
+
 	},
 
 	distanceToSphere: function ( sphere ) {
 
 		return this.distanceToPoint( sphere.center ) - sphere.radius;
+
 	},
 
 	projectPoint: function ( point ) {
@@ -104,6 +110,7 @@ THREE.Plane.prototype = {
 	intersectsLine: function ( startPoint, endPoint ) {
 
 		// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
+
 		var startSign = this.distanceToPoint( startPoint );
 		var endSign = this.distanceToPoint( endPoint );
 
@@ -134,6 +141,7 @@ THREE.Plane.prototype = {
 	clone: function () {
 
 		return new THREE.Plane().copy( this );
+
 	}
 
 };

+ 1 - 1
src/core/Sphere.js

@@ -117,7 +117,7 @@ THREE.Sphere.prototype = {
 
 	equals: function ( sphere ) {
 
-		return sphere.center.equals( this.center ) && ( sphere.radius == this.radius );
+		return sphere.center.equals( this.center ) && ( sphere.radius === this.radius );
 
 	},
 

+ 28 - 11
src/core/Vector2.js

@@ -74,7 +74,7 @@ THREE.Vector2.prototype = {
 		this.y += v.y;
 
 		return this;
-		
+
 	},
 
 	sub: function ( a, b ) {
@@ -123,11 +123,16 @@ THREE.Vector2.prototype = {
 
 	minSelf: function ( v ) {
 
-		if( this.x > v.x ) {
+		if ( this.x > v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y > v.y ) {
+
+		if ( this.y > v.y ) {
+
 			this.y = v.y;
+
 		}
 
 		return this;
@@ -136,11 +141,16 @@ THREE.Vector2.prototype = {
 
 	maxSelf: function ( v ) {
 
-		if( this.x < v.x ) {
+		if ( this.x < v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y < v.y ) {
+
+		if ( this.y < v.y ) {
+
 			this.y = v.y;
+
 		}
 
 		return this;
@@ -151,21 +161,28 @@ THREE.Vector2.prototype = {
 
 		// This function assumes min < max, if this assumption isn't true it will not operate correctly
 
-		if( this.x < min.x ) {
+		if ( this.x < min.x ) {
+
 			this.x = min.x;
-		}
-		else if( this.x > max.x ) {
+
+		} else if ( this.x > max.x ) {
+
 			this.x = max.x;
+
 		}
 
-		if( this.y < min.y ) {
+		if ( this.y < min.y ) {
+
 			this.y = min.y;
-		}
-		else if( this.y > max.y ) {
+
+		} else if ( this.y > max.y ) {
+
 			this.y = max.y;
+
 		}
 
 		return this;
+
 	},
 
 	negate: function() {

+ 41 - 15
src/core/Vector3.js

@@ -176,14 +176,22 @@ THREE.Vector3.prototype = {
 
 	minSelf: function ( v ) {
 
-		if( this.x > v.x ) {
+		if ( this.x > v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y > v.y ) {
+
+		if ( this.y > v.y ) {
+
 			this.y = v.y;
+
 		}
-		if( this.z > v.z ) {
+
+		if ( this.z > v.z ) {
+
 			this.z = v.z;
+
 		}
 
 		return this;
@@ -192,14 +200,22 @@ THREE.Vector3.prototype = {
 
 	maxSelf: function ( v ) {
 
-		if( this.x < v.x ) {
+		if ( this.x < v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y < v.y ) {
+
+		if ( this.y < v.y ) {
+
 			this.y = v.y;
+
 		}
-		if( this.z < v.z ) {
+
+		if ( this.z < v.z ) {
+
 			this.z = v.z;
+
 		}
 
 		return this;
@@ -210,28 +226,38 @@ THREE.Vector3.prototype = {
 
 		// This function assumes min < max, if this assumption isn't true it will not operate correctly
 
-		if( this.x < min.x ) {
+		if ( this.x < min.x ) {
+
 			this.x = min.x;
-		}
-		else if( this.x > max.x ) {
+
+		} else if ( this.x > max.x ) {
+
 			this.x = max.x;
+
 		}
 
-		if( this.y < min.y ) {
+		if ( this.y < min.y ) {
+
 			this.y = min.y;
-		}
-		else if( this.y > max.y ) {
+
+		} else if ( this.y > max.y ) {
+
 			this.y = max.y;
+
 		}
 
-		if( this.z < min.z ) {
+		if ( this.z < min.z ) {
+
 			this.z = min.z;
-		}
-		else if( this.z > max.z ) {
+
+		} else if ( this.z > max.z ) {
+
 			this.z = max.z;
+
 		}
 
 		return this;
+
 	},
 
 	negate: function() {

+ 56 - 21
src/core/Vector4.js

@@ -163,17 +163,28 @@ THREE.Vector4.prototype = {
 
 	minSelf: function ( v ) {
 
-		if( this.x > v.x ) {
+		if ( this.x > v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y > v.y ) {
+
+		if ( this.y > v.y ) {
+
 			this.y = v.y;
+
 		}
-		if( this.z > v.z ) {
+
+		if ( this.z > v.z ) {
+
 			this.z = v.z;
+
 		}
-		if( this.w > v.w ) {
+
+		if ( this.w > v.w ) {
+
 			this.w = v.w;
+
 		}
 
 		return this;
@@ -182,17 +193,28 @@ THREE.Vector4.prototype = {
 
 	maxSelf: function ( v ) {
 
-		if( this.x < v.x ) {
+		if ( this.x < v.x ) {
+
 			this.x = v.x;
+
 		}
-		if( this.y < v.y ) {
+
+		if ( this.y < v.y ) {
+
 			this.y = v.y;
+
 		}
-		if( this.z < v.z ) {
+
+		if ( this.z < v.z ) {
+
 			this.z = v.z;
+
 		}
-		if( this.w < v.w ) {
+
+		if ( this.w < v.w ) {
+
 			this.w = v.w;
+
 		}
 
 		return this;
@@ -203,35 +225,48 @@ THREE.Vector4.prototype = {
 
 		// This function assumes min < max, if this assumption isn't true it will not operate correctly
 
-		if( this.x < min.x ) {
+		if ( this.x < min.x ) {
+
 			this.x = min.x;
-		}
-		else if( this.x > max.x ) {
+
+		} else if ( this.x > max.x ) {
+
 			this.x = max.x;
+
 		}
 
-		if( this.y < min.y ) {
+		if ( this.y < min.y ) {
+
 			this.y = min.y;
-		}
-		else if( this.y > max.y ) {
+
+		} else if ( this.y > max.y ) {
+
 			this.y = max.y;
+
 		}
 
-		if( this.z < min.z ) {
+		if ( this.z < min.z ) {
+
 			this.z = min.z;
-		}
-		else if( this.z > max.z ) {
+
+		} else if ( this.z > max.z ) {
+
 			this.z = max.z;
+
 		}
 
-		if( this.w < min.w ) {
+		if ( this.w < min.w ) {
+
 			this.w = min.w;
-		}
-		else if( this.w > max.w ) {
+
+		} else if ( this.w > max.w ) {
+
 			this.w = max.w;
+
 		}
 
 		return this;
+
 	},
 
 	negate: function() {
@@ -437,7 +472,7 @@ THREE.Vector4.prototype = {
 						 + ( m13 - m31 ) * ( m13 - m31 )
 						 + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize
 
-		if ( Math.abs( s ) < 0.001 ) s = 1; 
+		if ( Math.abs( s ) < 0.001 ) s = 1;
 
 		// prevent divide by zero, should not happen if matrix is orthogonal and should be
 		// caught by singularity test above, but I've left it in just in case

Some files were not shown because too many files changed in this diff