Browse Source

Docs: Ray.

Mr.doob 13 years ago
parent
commit
27ccf487bd
2 changed files with 25 additions and 23 deletions
  1. 8 5
      docs/api/core/Ray.html
  2. 17 18
      src/core/Ray.js

+ 8 - 5
docs/api/core/Ray.html

@@ -10,15 +10,18 @@
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:Vector3 origin]</h3>
+
+<h3>.[page:Vector3 direction]</h3>
 
 
 <h2>Methods</h2>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
-<div>
-todo — todo<br />
-</div>
+<h3>.setPrecision( [page:Float value] )</h3>
+
+<h3>.intersectObject( [page:Object3D object] ) [page:Object]</h3>
+
+<h3>.intersectObjects( [page:Array objects] ) [page:Array]</h3>
 
 
 <h2>Source</h2>

+ 17 - 18
src/core/Ray.js

@@ -7,23 +7,6 @@ THREE.Ray = function ( origin, direction ) {
 	this.origin = origin || new THREE.Vector3();
 	this.direction = direction || new THREE.Vector3();
 
-	this.intersectObjects = function ( objects ) {
-
-		var i, l, object,
-		intersects = [];
-
-		for ( i = 0, l = objects.length; i < l; i ++ ) {
-
-			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
-
-		}
-
-		intersects.sort( function ( a, b ) { return a.distance - b.distance; } );
-
-		return intersects;
-
-	};
-
 	var precision = 0.0001;
 
 	this.setPrecision = function ( value ) {
@@ -178,6 +161,22 @@ THREE.Ray = function ( origin, direction ) {
 
 	}
 
+	this.intersectObjects = function ( objects ) {
+
+		var intersects = [];
+
+		for ( var i = 0, l = objects.length; i < l; i ++ ) {
+
+			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
+
+		}
+
+		intersects.sort( function ( a, b ) { return a.distance - b.distance; } );
+
+		return intersects;
+
+	};
+
 	var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3();
 	var dot, intersect, distance;
 
@@ -217,4 +216,4 @@ THREE.Ray = function ( origin, direction ) {
 
 	}
 
-};
+};