|
| void | add_element (const point_t &point, const data_t &data, bool delayInsertion=false) |
| | adds an element to the tree.
|
| |
| Element | closest_element (const point_t &point) const |
| | finds the closest tree-element to a given point in space
|
| |
| void | closest_elements (vector< Element > &elemsOut, const point_t &point, size_t n) const |
| | returns the n closest tree-elements to a given point in space
|
| |
| bool | empty () const |
| | returns true if the tree is empty
|
| |
| real_t | estimate_balance_quality () |
| | estimates the balance quality of the tree in the range [0, 1].
|
| |
| size_t | num_delayed_elements () const |
| | returns the number of elements which are scheduled for delayed insertion
|
| |
| void | rebalance () |
| | rebalances the whole tree
|
| |
| void | set_desc (const KDTreeDesc &desc) |
| | sets the balancing-parameters of the tree. Triggers a rebalance if a value changed.
|
| |
| size_t | size () const |
| | returns the number of elements in the tree
|
| |
template<class point_t, class data_t, class real_t = float>
class ug::KDTree< point_t, data_t, real_t >
JUST AN EARLY MOCKUP - no implementation is yet provided... A KDTree is a space-partitioning tree which
template<class point_t , class data_t , class real_t = float>
| void ug::KDTree< point_t, data_t, real_t >::add_element |
( |
const point_t & |
point, |
|
|
const data_t & |
data, |
|
|
bool |
delayInsertion = false |
|
) |
| |
adds an element to the tree.
If 'delayInsertion' is disabled (disabled by default), elements are inserted into their corresponding nodes on the fly. If the node's splitThreshold is surpassed, the elements of that node will be sorted into new child nodes automatically. Note that this may result in an unbalanced tree. You may call rebalance to reorder elements to receive a balanced tree. Alternatively you may add_element with 'delayInsertion = true'. All those elements will be collected and won't be inserted into the tree until rebalance is called.
template<class point_t , class data_t , class real_t = float>
| real_t ug::KDTree< point_t, data_t, real_t >::estimate_balance_quality |
( |
| ) |
|
estimates the balance quality of the tree in the range [0, 1].
The returned value represents the ratio to the smallest leaf (lowest level and smallest number of elements) to the maximum number of elements, that a node on the same level and its children have.
template<class point_t , class data_t , class real_t = float>
| void ug::KDTree< point_t, data_t, real_t >::split_leaf_node |
( |
Node & |
node | ) |
|
|
private |
splits a node into two child nodes and assigns elements to those children.
If the node-threshold of a child node is surpassed, then the child will be splitted recursively. Make sure that the given node is a leaf node and thus hasn't got children.