mourner / rbush

RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removing [x,y] points from tree

biggerlambda opened this issue · comments

I want to insert [x,y] items and then remove them if the item to be removed has x and y equal to that of the item in the tree.

I follow the following for inserting:
var tree = rbush(9, ['[0]', '[1]', '[0]', '[1]']); // accept [x, y] points
tree.insert([20, 50]);

Would the following work for removal:
tree.remove([20,50], function(a,b){return a.minX == b.minX && a.minY == b.minY ;})

The following should work:

tree.remove([20,50], function(a, b) {
  return a[0] === b[0] && a[1] === b[1]; 
});

Please don't use GitHub issues as a support channel. It's for reporting actual issues with the library, not for asking questions that you can answer yourself with a bit of effort.