Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

kd-tree implementation?

3 views
Skip to first unread message

carl

unread,
Nov 2, 2009, 12:15:13 PM11/2/09
to
I am looking for a kd-tree implementation that returns the set of k closest
neighbors from a point P and a specified region R. Something like this:


std::vector<MyNeighborType> neighbors;
tree->Search( P, R, neighbors ) ;

In the implementation that I have found its not possible to specify a
neighbor type. I need this because each neighbor has some unique information
that I must use in the following computations.

Any suggestions on where to find a kd-tree that returns user-specified
objects instead of basic vectors - location?

paperab

unread,
Nov 2, 2009, 2:30:45 PM11/2/09
to

Memorize pointers to objects instead of objects, store the common base
class pointers into the vector and cast back the object with the
dynamic_cast.

This technique is often used in user interfaces where you cannot
predict which specific set of objects the user will select.

cheers
paperab

0 new messages