提交 c5387612 编写于 作者: M Mr.doob

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

...@@ -39,8 +39,8 @@ THREE.Plane.prototype = { ...@@ -39,8 +39,8 @@ THREE.Plane.prototype = {
setFromCoplanarPoints: function ( a, b, c ) { setFromCoplanarPoints: function ( a, b, c ) {
var normal = THREE.Plane3.__v1.sub( b, a ).cross( var normal = THREE.Plane.__v1.sub( b, a ).cross(
THREE.Plane3.__v2.sub( c, a ) ); THREE.Plane.__v2.sub( c, a ) );
// 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)?
this.setFromNormalAndCoplanarPoint( normal, a ); this.setFromNormalAndCoplanarPoint( normal, a );
...@@ -133,8 +133,7 @@ THREE.Plane.prototype = { ...@@ -133,8 +133,7 @@ THREE.Plane.prototype = {
clone: function () { clone: function () {
return new THREE.Plane3().copy( this ); return new THREE.Plane().copy( this );
} }
}; };
......
...@@ -50,6 +50,15 @@ THREE.Vector2.prototype = { ...@@ -50,6 +50,15 @@ THREE.Vector2.prototype = {
}, },
addScalar: function ( s ) {
this.x += s;
this.y += s;
return this;
},
add: function ( a, b ) { add: function ( a, b ) {
this.x = a.x + b.x; this.x = a.x + b.x;
......
...@@ -73,6 +73,17 @@ THREE.Vector4.prototype = { ...@@ -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 ) { add: function ( a, b ) {
this.x = a.x + b.x; this.x = a.x + b.x;
......
/** /**
* @author bhouston / http://exocortex.com * @author bhouston / http://exocortex.com
*/ */
...@@ -107,7 +107,7 @@ test( "expandByScalar", function() { ...@@ -107,7 +107,7 @@ test( "expandByScalar", function() {
ok( a.size().equals( zero ), "Passed!" ); ok( a.size().equals( zero ), "Passed!" );
a.expandByScalar( 1 ); 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!" ); ok( a.center().equals( zero ), "Passed!" );
}); });
...@@ -207,7 +207,7 @@ test( "isIntersection", function() { ...@@ -207,7 +207,7 @@ test( "isIntersection", function() {
ok( c.isIntersection( a ), "Passed!" ); ok( c.isIntersection( a ), "Passed!" );
ok( b.isIntersection( c ), "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( ! a.isIntersection( b ), "Passed!" );
ok( ! b.isIntersection( a ), "Passed!" ); ok( ! b.isIntersection( a ), "Passed!" );
ok( ! c.isIntersection( a ), "Passed!" ); ok( ! c.isIntersection( a ), "Passed!" );
......
...@@ -107,7 +107,7 @@ test( "expandByScalar", function() { ...@@ -107,7 +107,7 @@ test( "expandByScalar", function() {
ok( a.size().equals( zero ), "Passed!" ); ok( a.size().equals( zero ), "Passed!" );
a.expandByScalar( 1 ); 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!" ); ok( a.center().equals( zero ), "Passed!" );
}); });
...@@ -207,7 +207,7 @@ test( "isIntersection", function() { ...@@ -207,7 +207,7 @@ test( "isIntersection", function() {
ok( c.isIntersection( a ), "Passed!" ); ok( c.isIntersection( a ), "Passed!" );
ok( b.isIntersection( c ), "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( ! a.isIntersection( b ), "Passed!" );
ok( ! b.isIntersection( a ), "Passed!" ); ok( ! b.isIntersection( a ), "Passed!" );
ok( ! c.isIntersection( a ), "Passed!" ); ok( ! c.isIntersection( a ), "Passed!" );
......
...@@ -33,7 +33,7 @@ test( "set", function() { ...@@ -33,7 +33,7 @@ test( "set", function() {
ok( a.center.equals( zero ), "Passed!" ); ok( a.center.equals( zero ), "Passed!" );
ok( a.radius == 0, "Passed!" ); ok( a.radius == 0, "Passed!" );
a.set( one, radius ) a.set( one, 1 )
ok( a.center.equals( one ), "Passed!" ); ok( a.center.equals( one ), "Passed!" );
ok( a.radius == 0, "Passed!" ); ok( a.radius == 1, "Passed!" );
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册