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

jsBVH.remove ( options )

Options:

intervals1 : required : An area to search within.
object : optional : An object to remove from the BVH. If no object is specified, all elements that touch the specified intervals are deleted.
comparators : options : An object. Defaults to { overlap_intervals: jsBVH.Interval.overlap_intervals, contains_intervals: jsBVH.Interval.contains_intervals } . Use this to override the default comparators to implement different search geometries. Default geometries is an n-dimensional “cube”.

Returns:

The number of objects deleted from the BVH.

Usage:

Deletes all object that touch the 10×15 rectangle starting at position 12×23 in a 2-dimensional BVH:
var myDelCount = myBVH.delete( { intervals: [{a:12, b:10}, {a:23, b:15}] } );
Delete only specific_object if it touches the 10×15 rectangle starting at position 12×23 in a 2-dimensional BVH:
var myDelCount = myBVH.delete( { intervals: [{a:12, b:10}, {a:23, b:15}], object: specific_object } );

Notes

1 Intervals are any array with length equal to the number of dimensions that contains object literals with two values {a, b}. The object itself is not saved or used directly but a copy is made.
Examples:
1-D:
Intervals = [{a,b}];
2-D:
Intervals = [{a,b},{a,b}];
3-D:
Intervals = [{a,b},{a,b},{a,b}];

Clone this wiki locally