Bersaelor / KDTree

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

Add a condition to the nearest neighbor methods #31

Closed chriseidhof closed 6 years ago

chriseidhof commented 6 years ago

Here's a PR with the conditional.

I'm pretty sure the nearestK version is correct, but Im' not sure if the nearest is correct, please review. What would be even better is adding tests (that's why I marked it as WIP). However, as the project is still Swift 3, the test target isn't automatically added by SPM...

chriseidhof commented 6 years ago

Ok I added three tiny tests (the nearest(K) methods weren't under test yet)

Bersaelor commented 6 years ago

I thought I updated it to Swift4 in this commit: https://github.com/Bersaelor/KDTree/commit/cb620782149008861eb96a880780e96817282fe5 PS: Yep, forgot to add the test target when I updated to swift4.

chriseidhof commented 6 years ago

I thought the project was Swift 3 because of the missing test target :p

Bersaelor commented 6 years ago

I have to admit, the way the project grew the tests are out of wack. Since the xcodeproj I use for development is the one created by cocoapods in Example/KDTree.xcworkspace/ some tests are actually duplicated between Example/Tests/ and Tests. The former being the test-target tests associated with the cocoapods example app, the latter the KDTree tests. I'll refactor those so they share common tests.