Browse Source

simplify Ray constructor based on @mrdoob's feedback here: https://github.com/mrdoob/three.js/pull/2734#commitcomment-2244506

Ben Houston 12 years ago
parent
commit
328f5422be
1 changed files with 3 additions and 12 deletions
  1. 3 12
      src/math/Ray.js

+ 3 - 12
src/math/Ray.js

@@ -5,17 +5,8 @@
 THREE.Ray = function ( origin, direction ) {
 THREE.Ray = function ( origin, direction ) {
 
 
 
 
-	if ( origin === undefined && direction === undefined ) {
-
-		this.origin = new THREE.Vector3();
-		this.direction = new THREE.Vector3( 0, 0, 0 );
-
-	} else {
-
-		this.origin = origin.clone();
-		this.direction = direction.clone();
-
-	}
+	this.origin = origin !== undefined ? origin.clone() : new THREE.Vector3();
+	this.direction = direction !== undefined ? direction.clone() : new THREE.Vector3();
 
 
 };
 };
 
 
@@ -152,7 +143,7 @@ THREE.Ray.prototype = {
 			return true;
 			return true;
 
 
 		}
 		}
-		
+
 		// line is coplanar, return origin
 		// line is coplanar, return origin
 		if( plane.distanceToPoint( this.origin ) == 0 ) {
 		if( plane.distanceToPoint( this.origin ) == 0 ) {