Browse Source

more changes based on @gero3's feedback. (also removed new Number() in clones)

Ben Houston 12 years ago
parent
commit
977c0b5fb4
2 changed files with 3 additions and 5 deletions
  1. 2 4
      src/core/Plane.js
  2. 1 1
      src/core/Sphere.js

+ 2 - 4
src/core/Plane.js

@@ -51,7 +51,7 @@ THREE.Plane.prototype = {
 	copy: function ( plane ) {
 	copy: function ( plane ) {
 
 
 		this.normal.copy( plane.normal );
 		this.normal.copy( plane.normal );
-		this.constant = new Number( plane.constant );
+		this.constant = plane.constant;
 
 
 		return this;
 		return this;
 	},
 	},
@@ -85,9 +85,7 @@ THREE.Plane.prototype = {
 
 
 	projectPoint: function ( point ) {		
 	projectPoint: function ( point ) {		
 		
 		
-		// TODO: optimize this by expanding and simplifying
-		
-		return new THREE.Vector3().copy( point ).sub( this.orthoPoint( point ) );
+		return this.orthoPoint( point ).subSelf( point ).negate();
 	},
 	},
 
 
 	orthoPoint: function ( point ) {		
 	orthoPoint: function ( point ) {		

+ 1 - 1
src/core/Sphere.js

@@ -38,7 +38,7 @@ THREE.Sphere.prototype = {
 	copy: function ( sphere ) {
 	copy: function ( sphere ) {
 
 
 		this.center.copy( sphere.center );
 		this.center.copy( sphere.center );
-		this.radius = sphere.radius.clone();
+		this.radius = sphere.radius;
 
 
 		return this;
 		return this;
 	},
 	},