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

Definition of "intersection" could be made more explicit in the readme

mindcitycode opened this issue · comments

Those two rectangles

const one = { minX: 1, maxX: 2, minY: 1, maxY: 2 }
const two =  { minX: 0, maxX: 1, minY: 0, maxY: 1 }

do intersect according to rbush.

While this can be infered, reading the docs, from the fact that the algorithm works for both points and rectangles, it would be better if it was explicitly mentionned, for one could expect in cases such as the "one" and "two" boxes above, that having a zero width and height intersection (a point) would not be reported as intersection.

Note that in the GIS world, and specifically according to DE-9IM, two geometries intersect if they have at least one point in common. Compare against the concept of overlap. The language in rbush's docs is right.

Very interesting read, thanks.

No doubt rbush doc is right from this point of view. A bit of clarification nevertheless wouldnt hurt for users coming from other domains. (And the same goes for the "collides" method).