提交 f3671a9d 编写于 作者: B Ben Houston

remove non-core and trivial geometric primitive fucntions to reduce code bulk.

上级 44774275
......@@ -115,12 +115,6 @@ THREE.Box2.prototype = {
},
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 );
......
......@@ -133,12 +133,6 @@ THREE.Box3.prototype = {
},
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 );
......
......@@ -71,14 +71,6 @@ THREE.Plane.prototype = {
},
flip: function () {
this.normal.negate();
return this;
},
normalize: function () {
// Note: will lead to a divide by zero if the plane is invalid.
......
......@@ -46,19 +46,6 @@ THREE.Ray.prototype = {
},
recast: function ( t ) {
return this.clone().recastSelf( t );
},
flip: function () {
this.direction.negate();
return this;
},
closestPointToPoint: function ( point ) {
var result = point.clone().subSelf( this.origin );
......
......@@ -65,12 +65,6 @@ THREE.Sphere.prototype = {
},
volume: function () {
return Math.PI * 4 / 3 * ( this.radius * this.radius * this.radius );
},
containsPoint: function ( point ) {
return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );
......
......@@ -51,14 +51,6 @@ test( "empty/makeEmpty", function() {
ok( a.empty(), "Passed!" );
});
test( "volume", function() {
var a = new THREE.Box2( zero2, one2 );
ok( a.volume() == 1, "Passed!" );
a = new THREE.Box2( one2.clone().negate(), zero2 );
ok( a.volume() == 1, "Passed!" );
});
test( "center", function() {
var a = new THREE.Box2( zero2 );
......
......@@ -51,11 +51,6 @@ test( "empty/makeEmpty", function() {
ok( a.empty(), "Passed!" );
});
test( "volume", function() {
var a = new THREE.Box3( zero3, one3 );
ok( a.volume() == 1, "Passed!" );
});
test( "center", function() {
var a = new THREE.Box3( zero3 );
......
......@@ -78,14 +78,6 @@ test( "setFromNormalAndCoplanarPoint", function() {
ok( a.constant == 0, "Passed!" );
});
test( "flip", function() {
var a = new THREE.Plane( one3, 0 );
ok( a.normal.equals( one3 ), "Passed!" );
a.flip();
ok( a.normal.negate().equals( one3 ), "Passed!" );
});
test( "normalize", function() {
var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), 2 );
......
......@@ -43,7 +43,7 @@ test( "at", function() {
ok( a.at( 1 ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
});
test( "recast/recastSelf/clone", function() {
test( "recastSelf/clone", function() {
var a = new THREE.Ray( one3, new THREE.Vector3( 0, 0, 1 ) );
ok( a.recastSelf( 0 ).equals( a ), "Passed!" );
......@@ -55,25 +55,12 @@ test( "recast/recastSelf/clone", function() {
ok( c.recastSelf( 1 ).equals( new THREE.Ray( new THREE.Vector3( 1, 1, 2 ), new THREE.Vector3( 0, 0, 1 ) ) ), "Passed!" );
var d = a.clone();
var e = d.recast( 1 );
var e = d.clone().recastSelf( 1 );
ok( d.equals( a ), "Passed!" );
ok( ! e.equals( d ), "Passed!" );
ok( e.equals( c ), "Passed!" );
});
test( "flip", function() {
var a = new THREE.Ray( one3, new THREE.Vector3( 0, 0, 1 ) );
var b = a.clone();
b.flip();
ok( b.direction.equals( new THREE.Vector3( 0, 0, -1 ) ), "Passed!" );
ok( ! b.equals( a ), "Passed!" );
// and let's flip back to original direction
b.flip();
ok( b.equals( a ), "Passed!" );
});
test( "closestPointToPoint", function() {
var a = new THREE.Ray( one3, new THREE.Vector3( 0, 0, 1 ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册