浏览代码

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

Ben Houston 12 年之前
父节点
当前提交
f3671a9def
共有 9 个文件被更改,包括 2 次插入75 次删除
  1. 0 6
      src/math/Box2.js
  2. 0 6
      src/math/Box3.js
  3. 0 8
      src/math/Plane.js
  4. 0 13
      src/math/Ray.js
  5. 0 6
      src/math/Sphere.js
  6. 0 8
      test/core/Box2.js
  7. 0 5
      test/core/Box3.js
  8. 0 8
      test/core/Plane.js
  9. 2 15
      test/core/Ray.js

+ 0 - 6
src/math/Box2.js

@@ -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 );

+ 0 - 6
src/math/Box3.js

@@ -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 );

+ 0 - 8
src/math/Plane.js

@@ -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.

+ 0 - 13
src/math/Ray.js

@@ -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 );

+ 0 - 6
src/math/Sphere.js

@@ -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 ) );

+ 0 - 8
test/core/Box2.js

@@ -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 );
 

+ 0 - 5
test/core/Box3.js

@@ -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 );
 

+ 0 - 8
test/core/Plane.js

@@ -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 );
 	

+ 2 - 15
test/core/Ray.js

@@ -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 ) );