Browse Source

bug fixes. all examples now run while using Box3, Sphere and Plane.

Ben Houston 12 years ago
parent
commit
99ed426469
3 changed files with 7 additions and 5 deletions
  1. 4 2
      src/core/Box3.js
  2. 2 2
      src/core/Plane.js
  3. 1 1
      utils/includes/common.json

+ 4 - 2
src/core/Box3.js

@@ -6,11 +6,13 @@ THREE.Box3 = function ( min, max ) {
 
 	// TODO: Is this valid JavaScript to check if the parameters are specified?
 	if( ! min && ! max ) {			
+		this.min = new THREE.Vector3();
+		this.max = new THREE.Vector3();
 		this.makeEmpty();
 	}
 	else {
 		this.min = min || new THREE.Vector3();
-		this.max = max || this.min;		// This is done on purpose so you can make a box using a single point and then expand it.
+		this.max = max || new THREE.Vector3().copy( this.min );		// This is done on purpose so you can make a box using a single point and then expand it.
 	}
 };
 
@@ -35,7 +37,7 @@ THREE.Box3.prototype = {
 		}
 
 		return this;
-	};
+	},
 
 	setFromCenterAndSize: function ( center, size ) {
 

+ 2 - 2
src/core/Plane.js

@@ -70,7 +70,7 @@ THREE.Plane.prototype = {
 
 		// Note: will lead to a divide by zero if the plane is invalid.
 		var inverseNormalLength = 1.0 / this.normal.length();
-		this.normal.multipleByScalar( inverseNormalLength );
+		this.normal.multiplyScalar( inverseNormalLength );
 		this.constant *= inverseNormalLength;
 
 		return this;
@@ -97,7 +97,7 @@ THREE.Plane.prototype = {
 
 		var perpendicularMagnitude = this.distanceToPoint( point );
 
-		return new THREE.Vector3().copy( this.normal ).multipleByScalar( perpendicularMagnitude );
+		return new THREE.Vector3().copy( this.normal ).multiplyScalar( perpendicularMagnitude );
 	},
 
 	intersectsLine: function ( startPoint, endPoint ) {	

+ 1 - 1
utils/includes/common.json

@@ -1,11 +1,11 @@
 [
 	"../src/Three.js",
-	"../src/core/Box3.js",
 	"../src/core/Clock.js",
 	"../src/core/Color.js",
 	"../src/core/Vector2.js",
 	"../src/core/Vector3.js",
 	"../src/core/Vector4.js",
+	"../src/core/Box3.js",
 	"../src/core/Matrix3.js",
 	"../src/core/Matrix4.js",
 	"../src/core/EventTarget.js",