flatbush
flatbush copied to clipboard
Default add() arguments to zero-width rects?
Flatbush is often used to index points, i.e., zero-width rectangles.
How do you feel about changing the signature of add
to
add(minX, minY, maxX = minX, maxY = minY)
as a minor DX improvement for point indexing, so that repeating the coordinates can be avoided in this case?
Related: https://github.com/mourner/flatbush/issues/33
Yeah, this makes sense! Let's make sure benchmarks don't show a regression (v8 can be weird sometimes) but if not, let's do it.
I would like this feature too. I'm working to understand the RTree algorithm, and when the bounding rectangles are necessary for search vs the object stored. I added the #48 PR as a first step.
Ahh. I think https://github.com/mourner/kdbush solves this usecase. @mourner Can you confirm? Thanks for the great work.