浏览代码

Merge remote-tracking branch 'bhouston/transform' into dev

Mr.doob 12 年之前
父节点
当前提交
c1fa178dfb

+ 1 - 1
examples/css3d_molecules.html

@@ -361,7 +361,7 @@
 				loader.load( url, function ( geometry, geometryBonds ) {
 				loader.load( url, function ( geometry, geometryBonds ) {
 
 
 					var offset = THREE.GeometryUtils.center( geometry );
 					var offset = THREE.GeometryUtils.center( geometry );
-					geometryBonds.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
+					geometryBonds.applyMatrix( new THREE.Matrix4().makeTranslation( offset ) );
 
 
 					for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 					for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 
 

+ 10 - 5
examples/webgl_geometry_minecraft.html

@@ -93,26 +93,31 @@
 				var pxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var pxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pxGeometry.faces[ 0 ].materialIndex = 1;
 				pxGeometry.faces[ 0 ].materialIndex = 1;
 				pxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI / 2 ) );
 				pxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI / 2 ) );
-				pxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 50, 0, 0 ) );
+				pxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 50, 0, 0 ) ) );
 
 
 				var nxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var nxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nxGeometry.faces[ 0 ].materialIndex = 1;
 				nxGeometry.faces[ 0 ].materialIndex = 1;
 				nxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( - Math.PI / 2 ) );
 				nxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( - Math.PI / 2 ) );
-				nxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( - 50, 0, 0 ) );
+				nxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( - 50, 0, 0 ) ) );
 
 
 				var pyGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var pyGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pyGeometry.faces[ 0 ].materialIndex = 0;
 				pyGeometry.faces[ 0 ].materialIndex = 0;
 				pyGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
 				pyGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
-				pyGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 50, 0 ) );
+				pyGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 50, 0 ) ) );
 
 
 				var pzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var pzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pzGeometry.faces[ 0 ].materialIndex = 1;
 				pzGeometry.faces[ 0 ].materialIndex = 1;
-				pzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0, 50 ) );
+				pzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 0, 50 ) ) );
 
 
 				var nzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var nzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nzGeometry.faces[ 0 ].materialIndex = 1;
 				nzGeometry.faces[ 0 ].materialIndex = 1;
 				nzGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI ) );
 				nzGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI ) );
-				nzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0, -50 ) );
+				nzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 0, -50 ) ) );
 
 
 				//
 				//
 
 

+ 10 - 5
examples/webgl_geometry_minecraft_ao.html

@@ -104,30 +104,35 @@
 				pxGeometry.faces[ 0 ].materialIndex = 1;
 				pxGeometry.faces[ 0 ].materialIndex = 1;
 				pxGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				pxGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				pxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI / 2 ) );
 				pxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI / 2 ) );
-				pxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 50, 0, 0 ) );
+				pxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 50, 0, 0 ) ) );
 
 
 				var nxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var nxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nxGeometry.faces[ 0 ].materialIndex = 1;
 				nxGeometry.faces[ 0 ].materialIndex = 1;
 				nxGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				nxGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				nxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( - Math.PI / 2 ) );
 				nxGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( - Math.PI / 2 ) );
-				nxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( - 50, 0, 0 ) );
+				nxGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( - 50, 0, 0 ) ) );
 
 
 				var pyGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var pyGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pyGeometry.faces[ 0 ].materialIndex = 0;
 				pyGeometry.faces[ 0 ].materialIndex = 0;
 				pyGeometry.faces[ 0 ].vertexColors = [ light, light, light, light ];
 				pyGeometry.faces[ 0 ].vertexColors = [ light, light, light, light ];
 				pyGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
 				pyGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
-				pyGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 50, 0 ) );
+				pyGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 50, 0 ) ) );
 
 
 				var pzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var pzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pzGeometry.faces[ 0 ].materialIndex = 1;
 				pzGeometry.faces[ 0 ].materialIndex = 1;
 				pzGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				pzGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
-				pzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0, 50 ) );
+				pzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 0, 50 ) ) );
 
 
 				var nzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				var nzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nzGeometry.faces[ 0 ].materialIndex = 1;
 				nzGeometry.faces[ 0 ].materialIndex = 1;
 				nzGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				nzGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ];
 				nzGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI ) );
 				nzGeometry.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI ) );
-				nzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0, -50 ) );
+				nzGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 
+					new THREE.Vector3( 0, 0, -50 ) ) );
 
 
 				//
 				//
 
 

+ 1 - 1
examples/webgl_geometry_subdivision.html

@@ -212,7 +212,7 @@
 
 
 				if ( params.scale ) {
 				if ( params.scale ) {
 
 
-					geometry.applyMatrix( new THREE.Matrix4().makeScale( params.scale, params.scale, params.scale ) );
+					geometry.applyMatrix( new THREE.Matrix4().makeScale( new THREE.Vector3( params.scale, params.scale, params.scale ) ) );
 
 
 				}
 				}
 
 

+ 1 - 1
src/core/Raycaster.js

@@ -89,7 +89,7 @@
 
 
 			inverseMatrix.getInverse( object.matrixWorld );
 			inverseMatrix.getInverse( object.matrixWorld );
 
 
-			localRay.copy( raycaster.ray ).transformSelf( inverseMatrix );
+			localRay.copy( raycaster.ray ).transform( inverseMatrix );
 	
 	
 			for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
 			for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
 
 

+ 1 - 1
src/extras/GeometryUtils.js

@@ -383,7 +383,7 @@ THREE.GeometryUtils = {
 		offset.add( bb.min, bb.max );
 		offset.add( bb.min, bb.max );
 		offset.multiplyScalar( -0.5 );
 		offset.multiplyScalar( -0.5 );
 
 
-		geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
+		geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset ) );
 		geometry.computeBoundingBox();
 		geometry.computeBoundingBox();
 
 
 		return offset;
 		return offset;

+ 0 - 9
src/math/Box2.js

@@ -237,15 +237,6 @@ THREE.Box2.prototype = {
 
 
 	},
 	},
 
 
-	scale: function ( factor ) {
-
-		var sizeDeltaHalf = this.size().multiplyScalar( ( factor - 1 )  * 0.5 );
-		this.expandByVector( sizeDeltaHalf );
-
-		return this;
-
-	},
-
 	equals: function ( box ) {
 	equals: function ( box ) {
 
 
 		return box.min.equals( this.min ) && box.max.equals( this.max );
 		return box.min.equals( this.min ) && box.max.equals( this.max );

+ 26 - 7
src/math/Box3.js

@@ -244,19 +244,31 @@ THREE.Box3.prototype = {
 
 
 	},
 	},
 
 
-	translate: function ( offset ) {
-
-		this.min.addSelf( offset );
-		this.max.addSelf( offset );
+	transform: function ( matrix ) {
+		
+		// NOTE: I am using a binary pattern to specify all 2^3 combinations below
+		var newPoints = [
+			matrix.multiplyVector3( THREE.Box3.__v0.set( this.min.x, this.min.y, this.min.z ) ), // 000
+			matrix.multiplyVector3( THREE.Box3.__v1.set( this.min.x, this.min.y, this.max.z ) ), // 001
+			matrix.multiplyVector3( THREE.Box3.__v2.set( this.min.x, this.max.y, this.min.z ) ), // 010
+			matrix.multiplyVector3( THREE.Box3.__v3.set( this.min.x, this.max.y, this.max.z ) ), // 011
+			matrix.multiplyVector3( THREE.Box3.__v4.set( this.max.x, this.min.y, this.min.z ) ), // 100
+			matrix.multiplyVector3( THREE.Box3.__v5.set( this.max.x, this.min.y, this.max.z ) ), // 101
+			matrix.multiplyVector3( THREE.Box3.__v6.set( this.max.x, this.max.y, this.min.z ) ), // 110
+			matrix.multiplyVector3( THREE.Box3.__v7.set( this.max.x, this.max.y, this.max.z ) )  // 111
+		];
+
+		this.makeEmpty();
+		this.setFromPoints( newPoints );
 
 
 		return this;
 		return this;
 
 
 	},
 	},
 
 
-	scale: function ( factor ) {
+	translate: function ( offset ) {
 
 
-		var sizeDeltaHalf = this.size().multiplyScalar( ( factor - 1 )  * 0.5 );
-		this.expandByVector( sizeDeltaHalf );
+		this.min.addSelf( offset );
+		this.max.addSelf( offset );
 
 
 		return this;
 		return this;
 
 
@@ -276,4 +288,11 @@ THREE.Box3.prototype = {
 
 
 };
 };
 
 
+THREE.Box3.__v0 = new THREE.Vector3();
 THREE.Box3.__v1 = new THREE.Vector3();
 THREE.Box3.__v1 = new THREE.Vector3();
+THREE.Box3.__v2 = new THREE.Vector3();
+THREE.Box3.__v3 = new THREE.Vector3();
+THREE.Box3.__v4 = new THREE.Vector3();
+THREE.Box3.__v5 = new THREE.Vector3();
+THREE.Box3.__v6 = new THREE.Vector3();
+THREE.Box3.__v7 = new THREE.Vector3();

+ 9 - 9
src/math/Matrix4.js

@@ -587,7 +587,7 @@ THREE.Matrix4.prototype = {
 		mRotation.identity();
 		mRotation.identity();
 		mRotation.setRotationFromQuaternion( rotation );
 		mRotation.setRotationFromQuaternion( rotation );
 
 
-		mScale.makeScale( scale.x, scale.y, scale.z );
+		mScale.makeScale( scale );
 
 
 		this.multiply( mRotation, mScale );
 		this.multiply( mRotation, mScale );
 
 
@@ -888,13 +888,13 @@ THREE.Matrix4.prototype = {
 
 
 	//
 	//
 
 
-	makeTranslation: function ( x, y, z ) {
+	makeTranslation: function ( offset ) {
 
 
 		this.set(
 		this.set(
 
 
-			1, 0, 0, x,
-			0, 1, 0, y,
-			0, 0, 1, z,
+			1, 0, 0, offset.x,
+			0, 1, 0, offset.y,
+			0, 0, 1, offset.z,
 			0, 0, 0, 1
 			0, 0, 0, 1
 
 
 		);
 		);
@@ -977,13 +977,13 @@ THREE.Matrix4.prototype = {
 
 
 	},
 	},
 
 
-	makeScale: function ( x, y, z ) {
+	makeScale: function ( factor ) {
 
 
 		this.set(
 		this.set(
 
 
-			x, 0, 0, 0,
-			0, y, 0, 0,
-			0, 0, z, 0,
+			factor.x, 0, 0, 0,
+			0, factor.y, 0, 0,
+			0, 0, factor.z, 0,
 			0, 0, 0, 1
 			0, 0, 0, 1
 
 
 		);
 		);

+ 24 - 5
src/math/Plane.js

@@ -4,7 +4,7 @@
 
 
 THREE.Plane = function ( normal, constant ) {
 THREE.Plane = function ( normal, constant ) {
 
 
-	this.normal = normal !== undefined ? normal.clone() : new THREE.Vector3();
+	this.normal = normal !== undefined ? normal.clone() : new THREE.Vector3( 1, 0, 0 );
 	this.constant = constant !== undefined ? constant : 0;
 	this.constant = constant !== undefined ? constant : 0;
 
 
 };
 };
@@ -33,8 +33,8 @@ THREE.Plane.prototype = {
 
 
 	setFromNormalAndCoplanarPoint: function ( normal, point ) {
 	setFromNormalAndCoplanarPoint: function ( normal, point ) {
 
 
-		this.normal.copy( normal );
-		this.constant = - point.dot( normal );
+		this.normal.copy( normal ).normalize();
+		this.constant = - point.dot( this.normal );	// must be this.normal, not normal, as this.normal is normalized
 
 
 		return this;
 		return this;
 
 
@@ -43,7 +43,7 @@ THREE.Plane.prototype = {
 	setFromCoplanarPoints: function ( a, b, c ) {
 	setFromCoplanarPoints: function ( a, b, c ) {
 
 
 		var normal = THREE.Plane.__v1.sub( c, b ).crossSelf(
 		var normal = THREE.Plane.__v1.sub( c, b ).crossSelf(
-					 THREE.Plane.__v2.sub( a, b ) );
+					 THREE.Plane.__v2.sub( a, b ) ).normalize();
 
 
 		// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
 		// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
 
 
@@ -119,9 +119,27 @@ THREE.Plane.prototype = {
 
 
 	},
 	},
 
 
+	transform: function( matrix, optionalNormalMatrix ) {
+
+		var newNormal = THREE.Plane.__v1, newCoplanarPoint = THREE.Plane.__v2;
+
+		// compute new normal based on theory here:
+		// http://www.songho.ca/opengl/gl_normaltransform.html
+		optionalNormalMatrix = optionalNormalMatrix || new THREE.Matrix3().getInverse( matrix ).transpose();
+		newNormal = optionalNormalMatrix.multiplyVector3( newNormal.copy( this.normal ) );
+
+		newCoplanarPoint = this.coplanarPoint( newCoplanarPoint );
+		newCoplanarPoint = matrix.multiplyVector3( newCoplanarPoint );
+
+		this.setFromNormalAndCoplanarPoint( newNormal, newCoplanarPoint );
+
+		return this;
+		
+	},
+
 	translate: function ( offset ) {
 	translate: function ( offset ) {
 
 
-		this.constant = - offset.dot( this.normal );
+		this.constant = this.constant - offset.dot( this.normal );
 
 
 		return this;
 		return this;
 
 
@@ -141,5 +159,6 @@ THREE.Plane.prototype = {
 
 
 };
 };
 
 
+THREE.Plane.__vZero = new THREE.Vector3( 0, 0, 0 );
 THREE.Plane.__v1 = new THREE.Vector3();
 THREE.Plane.__v1 = new THREE.Vector3();
 THREE.Plane.__v2 = new THREE.Vector3();
 THREE.Plane.__v2 = new THREE.Vector3();

+ 1 - 1
src/math/Ray.js

@@ -131,7 +131,7 @@ THREE.Ray.prototype = {
 
 
 	},
 	},
 
 
-	transformSelf: function ( matrix4 ) {
+	transform: function ( matrix4 ) {
 
 
 		this.direction = matrix4.multiplyVector3( this.direction.addSelf( this.origin ) );
 		this.direction = matrix4.multiplyVector3( this.direction.addSelf( this.origin ) );
 		this.origin = matrix4.multiplyVector3( this.origin );
 		this.origin = matrix4.multiplyVector3( this.origin );

+ 7 - 6
src/math/Sphere.js

@@ -96,17 +96,18 @@ THREE.Sphere.prototype = {
 
 
 	},
 	},
 
 
-	translate: function ( offset ) {
-
-		this.center.addSelf( this.offset );
+	transform: function ( matrix ) {
+		
+		this.center = matrix.multiplyVector3( this.center );
+		this.radius = this.radius * matrix.getMaxScaleOnAxis();
 
 
 		return this;
 		return this;
 
 
 	},
 	},
 
 
-	scale: function ( factor ) {
+	translate: function ( offset ) {
 
 
-		this.radius *= factor;
+		this.center.addSelf( offset );
 
 
 		return this;
 		return this;
 
 
@@ -120,7 +121,7 @@ THREE.Sphere.prototype = {
 
 
 	clone: function () {
 	clone: function () {
 
 
-		return new THREE.Sphere3().copy( this );
+		return new THREE.Sphere().copy( this );
 
 
 	}
 	}
 
 

+ 0 - 88
test/core/Plane.js

@@ -1,88 +0,0 @@
-/**
- * @author bhouston / http://exocortex.com
- */
-
-module( "Plane" );
-
-test( "constructor", function() {
-	var a = new THREE.Plane();
-	ok( a.normal.x == 0, "Passed!" );
-	ok( a.normal.y == 0, "Passed!" );
-	ok( a.normal.z == 0, "Passed!" );
-	ok( a.constant == 0, "Passed!" );
-
-	a = new THREE.Plane( one3, 0 );
-	ok( a.normal.x == 1, "Passed!" );
-	ok( a.normal.y == 1, "Passed!" );
-	ok( a.normal.z == 1, "Passed!" );
-	ok( a.constant == 0, "Passed!" );
-
-	a = new THREE.Plane( one3, 1 );
-	ok( a.normal.x == 1, "Passed!" );
-	ok( a.normal.y == 1, "Passed!" );
-	ok( a.normal.z == 1, "Passed!" );
-	ok( a.constant == 1, "Passed!" );
-});
-
-test( "copy", function() {
-	var a = new THREE.Plane( new THREE.Vector3( x, y, z ), w );
-	var b = new THREE.Plane().copy( a );
-	ok( b.normal.x == x, "Passed!" );
-	ok( b.normal.y == y, "Passed!" );
-	ok( b.normal.z == z, "Passed!" );
-	ok( b.constant == w, "Passed!" );
-
-	// ensure that it is a true copy
-	a.normal.x = 0;
-	a.normal.y = -1;
-	a.normal.z = -2;
-	a.constant = -3;
-	ok( b.normal.x == x, "Passed!" );
-	ok( b.normal.y == y, "Passed!" );
-	ok( b.normal.z == z, "Passed!" );
-	ok( b.constant == w, "Passed!" );
-});
-
-test( "set", function() {
-	var a = new THREE.Plane();
-	ok( a.normal.x == 0, "Passed!" );
-	ok( a.normal.y == 0, "Passed!" );
-	ok( a.normal.z == 0, "Passed!" );
-	ok( a.constant == 0, "Passed!" );
-
-	var b = a.clone().set( new THREE.Vector3( x, y, z ), w );
-	ok( b.normal.x == x, "Passed!" );
-	ok( b.normal.y == y, "Passed!" );
-	ok( b.normal.z == z, "Passed!" );
-	ok( b.constant == w, "Passed!" );
-});
-
-test( "setComponents", function() {
-	var a = new THREE.Plane();
-	ok( a.normal.x == 0, "Passed!" );
-	ok( a.normal.y == 0, "Passed!" );
-	ok( a.normal.z == 0, "Passed!" );
-	ok( a.constant == 0, "Passed!" );
-
-	var b = a.clone().setComponents( x, y, z , w );
-	ok( b.normal.x == x, "Passed!" );
-	ok( b.normal.y == y, "Passed!" );
-	ok( b.normal.z == z, "Passed!" );
-	ok( b.constant == w, "Passed!" );
-});
-
-test( "setFromNormalAndCoplanarPoint", function() {
-	var a = new THREE.Plane().setFromNormalAndCoplanarPoint( one3, zero3 );
-	
-	ok( a.normal.equals( one3 ), "Passed!" );
-	ok( a.constant == 0, "Passed!" );
-});
-
-test( "normalize", function() {
-	var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), 2 );
-	
-	a.normalize();
-	ok( a.normal.length() == 1, "Passed!" );
-	ok( a.normal.equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
-	ok( a.constant == 1, "Passed!" );
-});

+ 0 - 39
test/core/Sphere.js

@@ -1,39 +0,0 @@
-/**
- * @author bhouston / http://exocortex.com
- */
-
-module( "Sphere" );
-
-test( "constructor", function() {
-	var a = new THREE.Sphere();
-	ok( a.center.equals( zero3 ), "Passed!" );
-	ok( a.radius == 0, "Passed!" );
-
-	a = new THREE.Sphere( one3, 1 );
-	ok( a.center.equals( one3 ), "Passed!" );
-	ok( a.radius == 1, "Passed!" );
-});
-
-test( "copy", function() {
-	var a = new THREE.Sphere( one3, 1 );
-	var b = new THREE.Sphere().copy( a );
-
-	ok( b.center.equals( one3 ), "Passed!" );
-	ok( b.radius == 1, "Passed!" );
-
-	// ensure that it is a true copy
-	a.center = zero3;
-	a.radius = 0;
-	ok( b.center.equals( one3 ), "Passed!" );
-	ok( b.radius == 1, "Passed!" );
-});
-
-test( "set", function() {
-	var a = new THREE.Sphere();
-	ok( a.center.equals( zero3 ), "Passed!" );
-	ok( a.radius == 0, "Passed!" );
-
-	a.set( one3, 1 );
-	ok( a.center.equals( one3 ), "Passed!" );
-	ok( a.radius == 1, "Passed!" );
-});

+ 1 - 13
test/core/Box2.js → test/math/Box2.js

@@ -242,16 +242,4 @@ test( "translate", function() {
 	ok( a.clone().translate( one2 ).translate( one2.clone().negate() ).equals( a ), "Passed!" );
 	ok( a.clone().translate( one2 ).translate( one2.clone().negate() ).equals( a ), "Passed!" );
 	ok( d.clone().translate( one2 ).equals( b ), "Passed!" );
 	ok( d.clone().translate( one2 ).equals( b ), "Passed!" );
 	ok( b.clone().translate( one2.clone().negate() ).equals( d ), "Passed!" );
 	ok( b.clone().translate( one2.clone().negate() ).equals( d ), "Passed!" );
-});
-
-test( "scale", function() {
-	var a = new THREE.Box2( zero2, zero2 );
-	var b = new THREE.Box2( zero2, one2 );
-	var c = new THREE.Box2( one2.clone().negate(), one2 );
-	var d = new THREE.Box2( one2.clone().negate(), zero2 );
-
-	ok( a.clone().scale( 0 ).equals( a ), "Passed!" );
-	ok( c.clone().scale( 0 ).equals( a ), "Passed!" );
-	ok( b.clone().scale( 3 ).equals( new THREE.Box2( new THREE.Vector2( -1, -1, -1 ), new THREE.Vector2( 2, 2, 2 ) ) ), "Passed!" );
-	ok( d.clone().scale( 3 ).equals( new THREE.Box2( new THREE.Vector2( 2, 2, 2 ).negate(), new THREE.Vector2( 1, 1, 1 ) ) ), "Passed!" );
-});
+});

+ 20 - 10
test/core/Box3.js → test/math/Box3.js

@@ -232,26 +232,36 @@ test( "union", function() {
 	ok( b.clone().union( c ).equals( c ), "Passed!" );
 	ok( b.clone().union( c ).equals( c ), "Passed!" );
 });
 });
 
 
-test( "translate", function() {
+var compareBox = function ( a, b, threshold ) {
+	threshold = threshold || 0.0001;
+	return ( a.min.distanceTo( b.min ) < threshold &&
+	a.max.distanceTo( b.max ) < threshold );
+};
+
+test( "transform", function() {
 	var a = new THREE.Box3( zero3, zero3 );
 	var a = new THREE.Box3( zero3, zero3 );
 	var b = new THREE.Box3( zero3, one3 );
 	var b = new THREE.Box3( zero3, one3 );
 	var c = new THREE.Box3( one3.clone().negate(), one3 );
 	var c = new THREE.Box3( one3.clone().negate(), one3 );
 	var d = new THREE.Box3( one3.clone().negate(), zero3 );
 	var d = new THREE.Box3( one3.clone().negate(), zero3 );
 
 
-	ok( a.clone().translate( one3 ).equals( new THREE.Box3( one3, one3 ) ), "Passed!" );
-	ok( a.clone().translate( one3 ).translate( one3.clone().negate() ).equals( a ), "Passed!" );
-	ok( d.clone().translate( one3 ).equals( b ), "Passed!" );
-	ok( b.clone().translate( one3.clone().negate() ).equals( d ), "Passed!" );
+	var m = new THREE.Matrix4();
+
+	var t1 = new THREE.Vector3( 1, -2, 1 );
+	m.makeTranslation( t1 );
+	ok( compareBox( a.clone().transform( m ), a.clone().translate( t1 ) ), "Passed!" );
+	ok( compareBox( b.clone().transform( m ), b.clone().translate( t1 ) ), "Passed!" );
+	ok( compareBox( c.clone().transform( m ), c.clone().translate( t1 ) ), "Passed!" );
+	ok( compareBox( d.clone().transform( m ), d.clone().translate( t1 ) ), "Passed!" );
 });
 });
 
 
-test( "scale", function() {
+test( "translate", function() {
 	var a = new THREE.Box3( zero3, zero3 );
 	var a = new THREE.Box3( zero3, zero3 );
 	var b = new THREE.Box3( zero3, one3 );
 	var b = new THREE.Box3( zero3, one3 );
 	var c = new THREE.Box3( one3.clone().negate(), one3 );
 	var c = new THREE.Box3( one3.clone().negate(), one3 );
 	var d = new THREE.Box3( one3.clone().negate(), zero3 );
 	var d = new THREE.Box3( one3.clone().negate(), zero3 );
 
 
-	ok( a.clone().scale( 0 ).equals( a ), "Passed!" );
-	ok( c.clone().scale( 0 ).equals( a ), "Passed!" );
-	ok( b.clone().scale( 3 ).equals( new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 2, 2, 2 ) ) ), "Passed!" );
-	ok( d.clone().scale( 3 ).equals( new THREE.Box3( new THREE.Vector3( 2, 2, 2 ).negate(), new THREE.Vector3( 1, 1, 1 ) ) ), "Passed!" );
+	ok( a.clone().translate( one3 ).equals( new THREE.Box3( one3, one3 ) ), "Passed!" );
+	ok( a.clone().translate( one3 ).translate( one3.clone().negate() ).equals( a ), "Passed!" );
+	ok( d.clone().translate( one3 ).equals( b ), "Passed!" );
+	ok( b.clone().translate( one3.clone().negate() ).equals( d ), "Passed!" );
 });
 });

+ 0 - 0
test/core/Constants.js → test/math/Constants.js


+ 164 - 0
test/math/Plane.js

@@ -0,0 +1,164 @@
+/**
+ * @author bhouston / http://exocortex.com
+ */
+
+module( "Plane" );
+
+var comparePlane = function ( a, b, threshold ) {
+	threshold = threshold || 0.0001;
+	return ( a.normal.distanceTo( b.normal ) < threshold &&
+	Math.abs( a.constant - b.constant ) < threshold );
+};
+
+
+test( "constructor", function() {
+	var a = new THREE.Plane();
+	ok( a.normal.x == 1, "Passed!" );
+	ok( a.normal.y == 0, "Passed!" );
+	ok( a.normal.z == 0, "Passed!" );
+	ok( a.constant == 0, "Passed!" );
+
+	a = new THREE.Plane( one3, 0 );
+	ok( a.normal.x == 1, "Passed!" );
+	ok( a.normal.y == 1, "Passed!" );
+	ok( a.normal.z == 1, "Passed!" );
+	ok( a.constant == 0, "Passed!" );
+
+	a = new THREE.Plane( one3, 1 );
+	ok( a.normal.x == 1, "Passed!" );
+	ok( a.normal.y == 1, "Passed!" );
+	ok( a.normal.z == 1, "Passed!" );
+	ok( a.constant == 1, "Passed!" );
+});
+
+test( "copy", function() {
+	var a = new THREE.Plane( new THREE.Vector3( x, y, z ), w );
+	var b = new THREE.Plane().copy( a );
+	ok( b.normal.x == x, "Passed!" );
+	ok( b.normal.y == y, "Passed!" );
+	ok( b.normal.z == z, "Passed!" );
+	ok( b.constant == w, "Passed!" );
+
+	// ensure that it is a true copy
+	a.normal.x = 0;
+	a.normal.y = -1;
+	a.normal.z = -2;
+	a.constant = -3;
+	ok( b.normal.x == x, "Passed!" );
+	ok( b.normal.y == y, "Passed!" );
+	ok( b.normal.z == z, "Passed!" );
+	ok( b.constant == w, "Passed!" );
+});
+
+test( "set", function() {
+	var a = new THREE.Plane();
+	ok( a.normal.x == 1, "Passed!" );
+	ok( a.normal.y == 0, "Passed!" );
+	ok( a.normal.z == 0, "Passed!" );
+	ok( a.constant == 0, "Passed!" );
+
+	var b = a.clone().set( new THREE.Vector3( x, y, z ), w );
+	ok( b.normal.x == x, "Passed!" );
+	ok( b.normal.y == y, "Passed!" );
+	ok( b.normal.z == z, "Passed!" );
+	ok( b.constant == w, "Passed!" );
+});
+
+test( "setComponents", function() {
+	var a = new THREE.Plane();
+	ok( a.normal.x == 1, "Passed!" );
+	ok( a.normal.y == 0, "Passed!" );
+	ok( a.normal.z == 0, "Passed!" );
+	ok( a.constant == 0, "Passed!" );
+
+	var b = a.clone().setComponents( x, y, z , w );
+	ok( b.normal.x == x, "Passed!" );
+	ok( b.normal.y == y, "Passed!" );
+	ok( b.normal.z == z, "Passed!" );
+	ok( b.constant == w, "Passed!" );
+});
+
+test( "setFromNormalAndCoplanarPoint", function() {
+	var a = new THREE.Plane().setFromNormalAndCoplanarPoint( one3, zero3 );
+	
+	ok( a.normal.equals( one3.clone().normalize() ), "Passed!" );
+	ok( a.constant == 0, "Passed!" );
+});
+
+test( "normalize", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), 2 );
+	
+	a.normalize();
+	ok( a.normal.length() == 1, "Passed!" );
+	ok( a.normal.equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
+	ok( a.constant == 1, "Passed!" );
+});
+
+test( "distanceToPoint", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), -2 );
+	
+	a.normalize();
+	ok( a.distanceToPoint( a.projectPoint( zero3.clone() ) ) === 0, "Passed!" );
+	ok( a.distanceToPoint( new THREE.Vector3( 4, 0, 0 ) ) === 3, "Passed!" );
+});
+
+test( "distanceToSphere", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+
+	var b = new THREE.Sphere( new THREE.Vector3( 2, 0, 0 ), 1 );
+	
+	ok( a.distanceToSphere( b ) === 1, "Passed!" );
+
+	a.set( new THREE.Vector3( 1, 0, 0 ), 2 );
+	ok( a.distanceToSphere( b ) === 3, "Passed!" );
+	a.set( new THREE.Vector3( 1, 0, 0 ), -2 );
+	ok( a.distanceToSphere( b ) === -1, "Passed!" );
+});
+
+test( "projectPoint", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+
+	ok( a.projectPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( zero3 ), "Passed!" );
+	ok( a.projectPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( zero3 ), "Passed!" );
+
+	a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 );
+	ok( a.projectPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+	ok( a.projectPoint( new THREE.Vector3( 0, 1, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+	
+});
+
+test( "orthoPoint", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+
+	ok( a.orthoPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
+	ok( a.orthoPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( new THREE.Vector3( -10, 0, 0 ) ), "Passed!" );
+});
+
+/*
+test( "isIntersectionLine", function() {
+});
+*/
+
+test( "coplanarPoint", function() {
+	var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+	ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" );
+
+	a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 );
+	ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" );
+});
+
+test( "transform/translate", function() {
+
+	var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+
+	var m = new THREE.Matrix4();
+	m.makeRotationZ( Math.PI * 0.5 );
+
+	ok( comparePlane( a.clone().transform( m ), new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), 0 ) ), "Passed!" );
+
+	a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 );
+	ok( comparePlane( a.clone().transform( m ), new THREE.Plane( new THREE.Vector3( -1, 0, 0 ), -1 ) ), "Passed!" );
+
+	m.makeTranslation( new THREE.Vector3( 1, 1, 1 ) );
+	ok( comparePlane( a.clone().transform( m ), a.clone().translate( new THREE.Vector3( 1, 1, 1 ) ) ), "Passed!" );
+});

+ 5 - 5
test/core/Ray.js → test/math/Ray.js

@@ -149,26 +149,26 @@ test( "intersectPlane", function() {
 });
 });
 
 
 
 
-test( "transformSelf", function() {
+test( "transform", function() {
 	var a = new THREE.Ray( one3, new THREE.Vector3( 0, 0, 1 ) );
 	var a = new THREE.Ray( one3, new THREE.Vector3( 0, 0, 1 ) );
 	var m = new THREE.Matrix4().identity();
 	var m = new THREE.Matrix4().identity();
 
 
-	ok( a.clone().transformSelf( m ).equals( a ), "Passed!" );
+	ok( a.clone().transform( m ).equals( a ), "Passed!" );
 
 
 	a = new THREE.Ray( zero3, new THREE.Vector3( 0, 0, 1 ) );
 	a = new THREE.Ray( zero3, new THREE.Vector3( 0, 0, 1 ) );
 	m.rotateByAxis( new THREE.Vector3( 0, 0, 1 ), Math.PI );
 	m.rotateByAxis( new THREE.Vector3( 0, 0, 1 ), Math.PI );
-	ok( a.clone().transformSelf( m ).equals( a ), "Passed!" );
+	ok( a.clone().transform( m ).equals( a ), "Passed!" );
 
 
 	m.identity().rotateX( Math.PI );
 	m.identity().rotateX( Math.PI );
 	var b = a.clone();
 	var b = a.clone();
 	b.direction.negate();
 	b.direction.negate();
-	var a2 = a.clone().transformSelf( m );
+	var a2 = a.clone().transform( m );
 	ok( a2.origin.distanceTo( b.origin ) < 0.0001, "Passed!" );
 	ok( a2.origin.distanceTo( b.origin ) < 0.0001, "Passed!" );
 	ok( a2.direction.distanceTo( b.direction ) < 0.0001, "Passed!" );
 	ok( a2.direction.distanceTo( b.direction ) < 0.0001, "Passed!" );
 
 
 	a.origin = new THREE.Vector3( 0, 0, 1 );
 	a.origin = new THREE.Vector3( 0, 0, 1 );
 	b.origin = new THREE.Vector3( 0, 0, -1 );
 	b.origin = new THREE.Vector3( 0, 0, -1 );
-	var a2 = a.clone().transformSelf( m );
+	var a2 = a.clone().transform( m );
 	ok( a2.origin.distanceTo( b.origin ) < 0.0001, "Passed!" );
 	ok( a2.origin.distanceTo( b.origin ) < 0.0001, "Passed!" );
 	ok( a2.direction.distanceTo( b.direction ) < 0.0001, "Passed!" );
 	ok( a2.direction.distanceTo( b.direction ) < 0.0001, "Passed!" );
 });
 });

+ 94 - 0
test/math/Sphere.js

@@ -0,0 +1,94 @@
+/**
+ * @author bhouston / http://exocortex.com
+ */
+
+module( "Sphere" );
+
+test( "constructor", function() {
+	var a = new THREE.Sphere();
+	ok( a.center.equals( zero3 ), "Passed!" );
+	ok( a.radius == 0, "Passed!" );
+
+	a = new THREE.Sphere( one3, 1 );
+	ok( a.center.equals( one3 ), "Passed!" );
+	ok( a.radius == 1, "Passed!" );
+});
+
+test( "copy", function() {
+	var a = new THREE.Sphere( one3, 1 );
+	var b = new THREE.Sphere().copy( a );
+
+	ok( b.center.equals( one3 ), "Passed!" );
+	ok( b.radius == 1, "Passed!" );
+
+	// ensure that it is a true copy
+	a.center = zero3;
+	a.radius = 0;
+	ok( b.center.equals( one3 ), "Passed!" );
+	ok( b.radius == 1, "Passed!" );
+});
+
+test( "set", function() {
+	var a = new THREE.Sphere();
+	ok( a.center.equals( zero3 ), "Passed!" );
+	ok( a.radius == 0, "Passed!" );
+
+	a.set( one3, 1 );
+	ok( a.center.equals( one3 ), "Passed!" );
+	ok( a.radius == 1, "Passed!" );
+});
+
+test( "empty", function() {
+	var a = new THREE.Sphere();
+	ok( a.empty(), "Passed!" );
+
+	a.set( one3, 1 );
+	ok( ! a.empty(), "Passed!" );
+});
+
+test( "containsPoint", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	ok( ! a.containsPoint( zero3 ), "Passed!" );
+	ok( a.containsPoint( one3 ), "Passed!" );
+});
+
+test( "distanceToPoint", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	ok( ( a.distanceToPoint( zero3 ) - 0.7320 ) < 0.001, "Passed!" );
+	ok( a.distanceToPoint( one3 ) === -1, "Passed!" );
+});
+
+test( "clampPoint", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	ok( a.clampPoint( new THREE.Vector3( 1, 1, 3 ) ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
+	ok( a.clampPoint( new THREE.Vector3( 1, 1, -3 ) ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );
+});
+
+test( "bounds", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	ok( a.bounds().equals( new THREE.Box3( zero3, two3 ) ), "Passed!" );
+
+	a.set( zero3, 0 )
+	ok( a.bounds().equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" );
+});
+
+test( "transform", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	var m = new THREE.Matrix4();
+	var t1 = new THREE.Vector3( 1, -2, 1 );
+	m.makeTranslation( t1 );
+
+	ok( a.clone().transform( m ).bounds().equals( a.bounds().transform( m ) ), "Passed!" );
+});
+
+test( "translate", function() {
+	var a = new THREE.Sphere( one3, 1 );
+
+	a.translate( one3.clone().negate() );
+	ok( a.center.equals( zero3 ), "Passed!" );
+});

+ 0 - 0
test/core/Triangle.js → test/math/Triangle.js


+ 0 - 0
test/core/Vector2.js → test/math/Vector2.js


+ 0 - 0
test/core/Vector3.js → test/math/Vector3.js


+ 0 - 0
test/core/Vector4.js → test/math/Vector4.js


+ 10 - 10
test/sources.html

@@ -26,16 +26,16 @@
 
 
   <!-- add class-based unit tests below -->
   <!-- add class-based unit tests below -->
 
 
-  <script src="core/Constants.js"></script>
-  <script src="core/Box2.js"></script>
-  <script src="core/Box3.js"></script>
-  <script src="core/Plane.js"></script>
-  <script src="core/Ray.js"></script>
-  <script src="core/Sphere.js"></script>
-  <script src="core/Triangle.js"></script>
-  <script src="core/Vector2.js"></script>
-  <script src="core/Vector3.js"></script>
-  <script src="core/Vector4.js"></script>
+  <script src="math/Constants.js"></script>
+  <script src="math/Box2.js"></script>
+  <script src="math/Box3.js"></script>
+  <script src="math/Plane.js"></script>
+  <script src="math/Ray.js"></script>
+  <script src="math/Sphere.js"></script>
+  <script src="math/Triangle.js"></script>
+  <script src="math/Vector2.js"></script>
+  <script src="math/Vector3.js"></script>
+  <script src="math/Vector4.js"></script>
   
   
 </body>
 </body>
 </html>
 </html>

+ 10 - 10
test/three-math.html

@@ -15,16 +15,16 @@
 
 
   <!-- add class-based unit tests below -->
   <!-- add class-based unit tests below -->
 
 
-  <script src="core/Constants.js"></script>
-  <script src="core/Box2.js"></script>
-  <script src="core/Box3.js"></script>
-  <script src="core/Plane.js"></script>
-  <script src="core/Ray.js"></script>
-  <script src="core/Sphere.js"></script>
-  <script src="core/Triangle.js"></script>
-  <script src="core/Vector2.js"></script>
-  <script src="core/Vector3.js"></script>
-  <script src="core/Vector4.js"></script>
+  <script src="math/Constants.js"></script>
+  <script src="math/Box2.js"></script>
+  <script src="math/Box3.js"></script>
+  <script src="math/Plane.js"></script>
+  <script src="math/Ray.js"></script>
+  <script src="math/Sphere.js"></script>
+  <script src="math/Triangle.js"></script>
+  <script src="math/Vector2.js"></script>
+  <script src="math/Vector3.js"></script>
+  <script src="math/Vector4.js"></script>
   
   
 </body>
 </body>
 </html>
 </html>

+ 10 - 10
test/three.html

@@ -15,16 +15,16 @@
 
 
   <!-- add class-based unit tests below -->
   <!-- add class-based unit tests below -->
 
 
-  <script src="core/Constants.js"></script>
-  <script src="core/Box2.js"></script>
-  <script src="core/Box3.js"></script>
-  <script src="core/Plane.js"></script>
-  <script src="core/Ray.js"></script>
-  <script src="core/Sphere.js"></script>
-  <script src="core/Triangle.js"></script>
-  <script src="core/Vector2.js"></script>
-  <script src="core/Vector3.js"></script>
-  <script src="core/Vector4.js"></script>
+  <script src="math/Constants.js"></script>
+  <script src="math/Box2.js"></script>
+  <script src="math/Box3.js"></script>
+  <script src="math/Plane.js"></script>
+  <script src="math/Ray.js"></script>
+  <script src="math/Sphere.js"></script>
+  <script src="math/Triangle.js"></script>
+  <script src="math/Vector2.js"></script>
+  <script src="math/Vector3.js"></script>
+  <script src="math/Vector4.js"></script>
   
   
 </body>
 </body>
 </html>
 </html>

+ 10 - 10
test/three.min.html

@@ -15,16 +15,16 @@
 
 
   <!-- add class-based unit tests below -->
   <!-- add class-based unit tests below -->
 
 
-  <script src="core/Constants.js"></script>
-  <script src="core/Box2.js"></script>
-  <script src="core/Box3.js"></script>
-  <script src="core/Plane.js"></script>
-  <script src="core/Ray.js"></script>
-  <script src="core/Sphere.js"></script>
-  <script src="core/Triangle.js"></script>
-  <script src="core/Vector2.js"></script>
-  <script src="core/Vector3.js"></script>
-  <script src="core/Vector4.js"></script>
+  <script src="math/Constants.js"></script>
+  <script src="math/Box2.js"></script>
+  <script src="math/Box3.js"></script>
+  <script src="math/Plane.js"></script>
+  <script src="math/Ray.js"></script>
+  <script src="math/Sphere.js"></script>
+  <script src="math/Triangle.js"></script>
+  <script src="math/Vector2.js"></script>
+  <script src="math/Vector3.js"></script>
+  <script src="math/Vector4.js"></script>
   
   
 </body>
 </body>
 </html>
 </html>

+ 1 - 0
utils/build_all.bat

@@ -4,4 +4,5 @@ python build.py --include canvas --minify --output ../build/three-canvas.min.js
 python build.py --include css3d --minify --output ../build/three-css3d.min.js
 python build.py --include css3d --minify --output ../build/three-css3d.min.js
 python build.py --include webgl --minify --output ../build/three-webgl.min.js
 python build.py --include webgl --minify --output ../build/three-webgl.min.js
 python build.py --include extras --externs externs/extras.js --minify --output ../build/three-extras.min.js
 python build.py --include extras --externs externs/extras.js --minify --output ../build/three-extras.min.js
+python build.py --include math --output ../build/three-math.js
 python build.py --include math --minify --output ../build/three-math.min.js
 python build.py --include math --minify --output ../build/three-math.min.js