C
carl
First a short introduction to the problem:
I am using a kd-tree to find the k-nearest neighbors to a point, P, in 3D
euclidean space. The result is a list of 3D vectors corresponding to vectors
in 3D space. Something like:
[12,45,1]
[102,5,231]
[142,45,1]
[0,425,81]
....
Now each of these points are actually position fields in unique objects that
contains additional info. Currently I store these objects in a std::vector.
I then search the vector for objects that contains the positions returned
from the kd-tree. But this sorta kills the idea of using the kd-tree (in
worst case I need to run through the whole vector).
My ideas was therefore to think of the position returned from the kd-tree as
a key used in a hash-table. If I store my objects in a hash-table using the
position as keys I could then get constant time lookup.
This leads me to the following questions:
1) Where do I find a hash-table hash-map for c++? I have heard of the
unordered set/map but where is it located?
2) Is it possible to use a unique 3D vector like [12,3,4] as a key for the
above hash-table?
I am using a kd-tree to find the k-nearest neighbors to a point, P, in 3D
euclidean space. The result is a list of 3D vectors corresponding to vectors
in 3D space. Something like:
[12,45,1]
[102,5,231]
[142,45,1]
[0,425,81]
....
Now each of these points are actually position fields in unique objects that
contains additional info. Currently I store these objects in a std::vector.
I then search the vector for objects that contains the positions returned
from the kd-tree. But this sorta kills the idea of using the kd-tree (in
worst case I need to run through the whole vector).
My ideas was therefore to think of the position returned from the kd-tree as
a key used in a hash-table. If I store my objects in a hash-table using the
position as keys I could then get constant time lookup.
This leads me to the following questions:
1) Where do I find a hash-table hash-map for c++? I have heard of the
unordered set/map but where is it located?
2) Is it possible to use a unique 3D vector like [12,3,4] as a key for the
above hash-table?