提交 27ccf487 编写于 作者: M Mr.doob

Docs: Ray.

上级 5030e6e1
......@@ -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>
......
......@@ -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 ) {
}
};
};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册