RobWorkProject
23.9.11-
|
a space partitioning structure for organizing points in k-dimensional space. Used for searches involving multi.dimensional search keys, including nearest neighbor and range search. More...
#include <KDTreeQ.hpp>
Inherits Serializable.
Classes | |
struct | KDNode |
a struct for the node in the tree More... | |
struct | KDResult |
Public Types | |
typedef rw::core::Ptr< KDTreeQ< VALUE_TYPE > > | Ptr |
typedef rw::math::Q | KEY |
typedef KDNode | Node |
typedef KDResult | Result |
typedef VALUE_TYPE | Value |
Public Member Functions | |
KDTreeQ (size_t dim) | |
Constructor. More... | |
virtual | ~KDTreeQ () |
destructor | |
size_t | getDimensions () const |
gets the number of dimensions that this KDTreeQ supports More... | |
void | addNode (const rw::math::Q &key, VALUE_TYPE val) |
adds a key value pair to the KDTreeQ. More... | |
void | removeNode (const rw::math::Q &nnkey) |
remove the node with key nnkey More... | |
KDNode * | search (const rw::math::Q &nnkey) |
finds the KDNode with key equal to nnkey More... | |
KDNode & | nnSearch (const rw::math::Q &nnkey) |
finds the KDNode with the key closest too nnkey More... | |
void | nnSearchElipse (const rw::math::Q &nnkey, const rw::math::Q &radi, std::list< const KDNode * > &nodes) |
finds all neighbors in the hyperelipse with radius radi and center in nnkey. More... | |
void | nnSearchElipseRect (const rw::math::Q &nnkey, const rw::math::Q &radi, std::list< const KDNode * > &nodes) |
finds all neighbors in the hyperelipse with radius radi and center in nnkey. More... | |
void | nnSearchRect (const rw::math::Q &low, const rw::math::Q &upp, std::list< const KDNode * > &nodes) |
finds all neighbors in the hyperrectangle defined by the lower bound and the upper bound | |
void | read (rw::common::InputArchive &iarchive, const std::string &id) |
void | write (rw::common::OutputArchive &oarchive, const std::string &id) const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
destructor | |
Static Public Member Functions | |
static KDTreeQ * | buildTree (std::vector< KDNode > &nodes) |
Builds a KDTreeQ from a list of key values and nodes. This method is more efficient than creating an empty KDTreeQ and then inserting nodes. More... | |
static KDTreeQ * | buildTree (const std::vector< KDNode * > &nodes) |
Builds a KDTreeQ from a list of key values and nodes. This method is more efficient than creating an empty KDTreeQ and then inserting nodes. More... | |
a space partitioning structure for organizing points in k-dimensional space. Used for searches involving multi.dimensional search keys, including nearest neighbor and range search.
This KDTree implementation takes any value type but the key is constrained to a rw::math::Q
|
inline |
Constructor.
dim | [in] the dimension of the keys in the KDTreeQ |
void addNode | ( | const rw::math::Q & | key, |
VALUE_TYPE | val | ||
) |
|
inline |
gets the number of dimensions that this KDTreeQ supports
KDTreeQ< T >::KDNode & nnSearch | ( | const rw::math::Q & | nnkey | ) |
finds the KDNode with the key closest too nnkey
nnkey | [in] the key to which the nearest neighbor is found |
void nnSearchElipse | ( | const rw::math::Q & | nnkey, |
const rw::math::Q & | radi, | ||
std::list< const KDNode * > & | nodes | ||
) |
finds all neighbors in the hyperelipse with radius radi and center in nnkey.
nnkey | [in] the center of the hyperelipse |
radi | [in] the radius of the hyperelipse in euclidean 2-norm |
nodes | [out] a container for all nodes that is found within the hyperelipse |
void nnSearchElipseRect | ( | const rw::math::Q & | nnkey, |
const rw::math::Q & | radi, | ||
std::list< const KDNode * > & | nodes | ||
) |
finds all neighbors in the hyperelipse with radius radi and center in nnkey.
nnkey | [in] the center of the hyperelipse |
radi | [in] the radius of the hyperelipse in euclidean 2-norm |
nodes | [out] a container for all nodes that is found within the hyperelipse |
|
inlinevirtual |
Enable read-serialization of inherited class by implementing this method. Data is read from iarchive and filled into this object.
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
Implements Serializable.
void removeNode | ( | const rw::math::Q & | nnkey | ) |
remove the node with key nnkey
nnkey | [in] the key of the node to remove |
KDTreeQ< T >::KDNode * search | ( | const rw::math::Q & | nnkey | ) |
|
inlinevirtual |
Enable write-serialization of inherited class by implementing this method. Data is written to oarchive from this object.
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |
Implements Serializable.