Skip to content
imbcmdth edited this page Sep 14, 2010 · 1 revision

jsBVH.intersect ( options )

Options:

ray1 : required : An array. Each entry is a pair of numbers representing start(a) and direction(b) of the ray along a single dimension in the tree.
return_nodes : optional : A boolean. Defaults to false. Set to true to return an array of leaf nodes instead of an array of the objects contained within the leaf nodes.
return_array : optional : An array. Defaults to an empty array. The search function will append any objects found to this array.

Returns:

An array of objects that intersect ray.

Usage:

Search along a horizontal ray that starts at position -1×10 in a 2-dimensional BVH:
var myObjects = myBVHrsect( { ray: [{a:-1, b:1}, {a:10, b:0}] });

Notes

1 Ray is an array with length equal to the number of dimensions that contains object literals with two values {a, b}. {a:} is the ray’s origin along a dimension and {b:} is its the direction.
Examples:
1-D:
Ray= [{a,b}];
2-D:
Ray= [{a,b},{a,b}];
3-D:
Ray= [{a,b},{a,b},{a,b}];

Clone this wiki locally