Browse Source

Merge remote-tracking branch 'bhouston/test-suite' into dev

Mr.doob 12 years ago
parent
commit
c5387612dd
6 changed files with 30 additions and 11 deletions
  1. 3 4
      src/core/Plane.js
  2. 9 0
      src/core/Vector2.js
  3. 11 0
      src/core/Vector4.js
  4. 3 3
      test/core/Box2.js
  5. 2 2
      test/core/Box3.js
  6. 2 2
      test/core/Sphere.js

+ 3 - 4
src/core/Plane.js

@@ -39,8 +39,8 @@ THREE.Plane.prototype = {
 
 	setFromCoplanarPoints: function ( a, b, c ) {
 
-		var normal = THREE.Plane3.__v1.sub( b, a ).cross(
-			THREE.Plane3.__v2.sub( c, a ) );
+		var normal = THREE.Plane.__v1.sub( b, a ).cross(
+			THREE.Plane.__v2.sub( c, a ) );
 
 		// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
 		this.setFromNormalAndCoplanarPoint( normal, a );
@@ -133,8 +133,7 @@ THREE.Plane.prototype = {
 
 	clone: function () {
 
-		return new THREE.Plane3().copy( this );
-
+		return new THREE.Plane().copy( this );
 	}
 
 };

+ 9 - 0
src/core/Vector2.js

@@ -50,6 +50,15 @@ THREE.Vector2.prototype = {
 
 	},
 
+	addScalar: function ( s ) {
+
+		this.x += s;
+		this.y += s;
+
+		return this;
+
+	},
+
 	add: function ( a, b ) {
 
 		this.x = a.x + b.x;

+ 11 - 0
src/core/Vector4.js

@@ -73,6 +73,17 @@ THREE.Vector4.prototype = {
 
 	},
 
+	addScalar: function ( s ) {
+
+		this.x += s;
+		this.y += s;
+		this.z += s;
+		this.w += s;
+
+		return this;
+
+	},
+
 	add: function ( a, b ) {
 
 		this.x = a.x + b.x;

+ 3 - 3
test/core/Box2.js

@@ -1,4 +1,4 @@
-/**
+	/**
  * @author bhouston / http://exocortex.com
  */
 
@@ -107,7 +107,7 @@ test( "expandByScalar", function() {
 	ok( a.size().equals( zero ), "Passed!" );
 
 	a.expandByScalar( 1 );
-	ok( a.size().equals( oneone.clone().multiplyScalar( 2 ) ), "Passed!" );
+	ok( a.size().equals( one.clone().multiplyScalar( 2 ) ), "Passed!" );
 	ok( a.center().equals( zero ), "Passed!" );
 });
 
@@ -207,7 +207,7 @@ test( "isIntersection", function() {
 	ok( c.isIntersection( a ), "Passed!" );
 	ok( b.isIntersection( c ), "Passed!" );
 
-	b.translate( one.clone().translate( new THREE.Vector2( 2, 2 ) ));
+	b.translate( new THREE.Vector2( 2, 2 ) );
 	ok( ! a.isIntersection( b ), "Passed!" );
 	ok( ! b.isIntersection( a ), "Passed!" );
 	ok( ! c.isIntersection( a ), "Passed!" );

+ 2 - 2
test/core/Box3.js

@@ -107,7 +107,7 @@ test( "expandByScalar", function() {
 	ok( a.size().equals( zero ), "Passed!" );
 
 	a.expandByScalar( 1 );
-	ok( a.size().equals( oneone.clone().multiplyScalar( 2 ) ), "Passed!" );
+	ok( a.size().equals( one.clone().multiplyScalar( 2 ) ), "Passed!" );
 	ok( a.center().equals( zero ), "Passed!" );
 });
 
@@ -207,7 +207,7 @@ test( "isIntersection", function() {
 	ok( c.isIntersection( a ), "Passed!" );
 	ok( b.isIntersection( c ), "Passed!" );
 
-	b.translate( one.clone().translate( new THREE.Vector3( 2, 2, 2 ) ));
+	b.translate( new THREE.Vector3( 2, 2, 2 ) );
 	ok( ! a.isIntersection( b ), "Passed!" );
 	ok( ! b.isIntersection( a ), "Passed!" );
 	ok( ! c.isIntersection( a ), "Passed!" );

+ 2 - 2
test/core/Sphere.js

@@ -33,7 +33,7 @@ test( "set", function() {
 	ok( a.center.equals( zero ), "Passed!" );
 	ok( a.radius == 0, "Passed!" );
 
-	a.set( one, radius )
+	a.set( one, 1 )
 	ok( a.center.equals( one ), "Passed!" );
-	ok( a.radius == 0, "Passed!" );
+	ok( a.radius == 1, "Passed!" );
 });