From f3671a9def4a1081b72b09d108a836daae2c2196 Mon Sep 17 00:00:00 2001 From: Ben Houston Date: Mon, 3 Dec 2012 22:25:43 -0500 Subject: [PATCH] remove non-core and trivial geometric primitive fucntions to reduce code bulk. --- src/math/Box2.js | 6 ------ src/math/Box3.js | 6 ------ src/math/Plane.js | 8 -------- src/math/Ray.js | 13 ------------- src/math/Sphere.js | 6 ------ test/core/Box2.js | 8 -------- test/core/Box3.js | 5 ----- test/core/Plane.js | 8 -------- test/core/Ray.js | 17 ++--------------- 9 files changed, 2 insertions(+), 75 deletions(-) diff --git a/src/math/Box2.js b/src/math/Box2.js index 0f4eedc2b8..3b3fd64860 100644 --- a/src/math/Box2.js +++ b/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 ); diff --git a/src/math/Box3.js b/src/math/Box3.js index 7de0b325ed..86edda579a 100644 --- a/src/math/Box3.js +++ b/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 ); diff --git a/src/math/Plane.js b/src/math/Plane.js index 96fdb76425..fc27af247e 100644 --- a/src/math/Plane.js +++ b/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. diff --git a/src/math/Ray.js b/src/math/Ray.js index ce0a8f5e34..0e2f4c2f22 100644 --- a/src/math/Ray.js +++ b/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 ); diff --git a/src/math/Sphere.js b/src/math/Sphere.js index a2f0b2ca60..a907e47ec8 100644 --- a/src/math/Sphere.js +++ b/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 ) ); diff --git a/test/core/Box2.js b/test/core/Box2.js index 03141424c7..0782c3551c 100644 --- a/test/core/Box2.js +++ b/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 ); diff --git a/test/core/Box3.js b/test/core/Box3.js index 67d9503643..99a00d74db 100644 --- a/test/core/Box3.js +++ b/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 ); diff --git a/test/core/Plane.js b/test/core/Plane.js index 1a7eb526fb..1c11335d83 100644 --- a/test/core/Plane.js +++ b/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 ); diff --git a/test/core/Ray.js b/test/core/Ray.js index 001dd074ea..da07f234b0 100644 --- a/test/core/Ray.js +++ b/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 ) ); -- GitLab