Bersaelor / KDTree

Swift implementation of a k-dimensional binary space partitioning tree.
MIT License
153 stars 26 forks source link

[Feature request] forEach method #52

Closed chihogoogle closed 4 years ago

chihogoogle commented 4 years ago

Hi,

The current library already supports a lot APIs which covers most of the use cases but it would be nice if there's a forEach method defined below.

// Calls shouldEnd block starting from the nearest element to furthest element // from the given element, until the block returns true. func forEachNearestFrom(_ element: Element, shouldEnd: ((Element) -> Bool))

I think this would cover every case :)

Thanks! Chiho

Bersaelor commented 4 years ago

Good Idea!

I don’t know if I can get too it soon, as I’m rather busy with my startup looc.io atm. Maybe you can try creating a PR and I can help you with it?

chihogoogle commented 4 years ago

Sounds good to me! I can take a stab at implementing forEach. Not urgent due to other priorities but I'll look into it little later and send a PR once it's ready. I'll add a comment here if I need any help on understanding the data structure itself :)

Bersaelor commented 4 years ago

Method is available here