#12 Use passed-in dist function to find nearest neighbor

open-fixed
nobody
None
5
2010-09-04
2010-07-15
Anonymous
No

Geometry/kdtree.py

In function nearest_neighbor() the distance function used is self.dist(), instead of the passed-in function, which should just be called as dist().
Using self.dist() ends up always using the dist function defined in kdtree.py, and not the function passed in. PointKdtree::Point() tries to pass a distance function when calling kdtree::nearest_neighbor(), but it doesn't get used because of the problem just mentioned.

So just delete "self." in the two places where self.dist() appears in kdtree::nearest_neighbor().

Discussion

  • patch file

     
    Attachments
  • Lars
    Lars
    2010-09-04

    Hi anonymous,
    thanks for sharing this! Indeed the optional parameter was ignored before.
    I committed the change that you suggested as r657.

    thanks!
    Lars

     
  • Lars
    Lars
    2010-09-04

    • status: open --> open-fixed
     
  • The speed of advancement has been a shock, says Dr Dre. "I experienced no approach when we begun that it would get this substantial." [url=http://cheapdrdrebeatssolo.webs.com/]cheap beats by dre[/url] <a href="http://cheapdrdrebeatssolo.webs.com/" title="cheap beats by dre">cheap beats by dre</a>