flatbush icon indicating copy to clipboard operation
flatbush copied to clipboard

Default add() arguments to zero-width rects?

Open mootari opened this issue 2 years ago • 4 comments

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?

mootari avatar Apr 28 '22 08:04 mootari

Related: https://github.com/mourner/flatbush/issues/33

mootari avatar Apr 28 '22 11:04 mootari

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.

mourner avatar Apr 28 '22 17:04 mourner

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.

paddymul avatar May 27 '23 12:05 paddymul

Ahh. I think https://github.com/mourner/kdbush solves this usecase. @mourner Can you confirm? Thanks for the great work.

paddymul avatar May 27 '23 19:05 paddymul