Luanti 5.16.0-dev
Loading...
Searching...
No Matches
k_d_tree::DynamicKdTrees< Dim, Component, Id > Class Template Reference

#include <k_d_tree.h>

Collaboration diagram for k_d_tree::DynamicKdTrees< Dim, Component, Id >:

Classes

struct  DelEntry

Public Types

using Point = typename Tree::Point

Public Member Functions

void insert (const std::array< Component, Dim > &point, Id id)
void remove (Id id)
void update (const Point &newPos, Id id)
template<typename F>
void rangeQuery (const Point &min, const Point &max, const F &cb) const
size_t size () const

Private Types

using Tree = KdTree<Dim, Component, Id>

Private Member Functions

void updateDelEntries (uint8_t tree_idx)
void shrink_to_half ()

Private Attributes

std::vector< Treetrees
std::unordered_map< Id, DelEntrydel_entries
size_t n_entries = 0
size_t deleted = 0

Member Typedef Documentation

◆ Point

template<uint8_t Dim, class Component, class Id>
using k_d_tree::DynamicKdTrees< Dim, Component, Id >::Point = typename Tree::Point

◆ Tree

template<uint8_t Dim, class Component, class Id>
using k_d_tree::DynamicKdTrees< Dim, Component, Id >::Tree = KdTree<Dim, Component, Id>
private

Member Function Documentation

◆ insert()

template<uint8_t Dim, class Component, class Id>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::insert ( const std::array< Component, Dim > & point,
Id id )
inline

References n_entries, trees, and updateDelEntries().

Referenced by TEST_CASE(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rangeQuery()

template<uint8_t Dim, class Component, class Id>
template<typename F>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::rangeQuery ( const Point & min,
const Point & max,
const F & cb ) const
inline

References trees.

Referenced by TEST_CASE().

Here is the caller graph for this function:

◆ remove()

template<uint8_t Dim, class Component, class Id>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::remove ( Id id)
inline

References del_entries, deleted, n_entries, shrink_to_half(), and trees.

Referenced by TEST_CASE(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shrink_to_half()

template<uint8_t Dim, class Component, class Id>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::shrink_to_half ( )
inlineprivate

References _, k_d_tree::Points< Dim, Component >::begin(), del_entries, deleted, n_entries, k_d_tree::Points< Dim, Component >::setPoint(), trees, and updateDelEntries().

Referenced by remove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

template<uint8_t Dim, class Component, class Id>
size_t k_d_tree::DynamicKdTrees< Dim, Component, Id >::size ( ) const
inline

References deleted, and n_entries.

◆ update()

template<uint8_t Dim, class Component, class Id>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::update ( const Point & newPos,
Id id )
inline

References insert(), and remove().

Referenced by TEST_CASE().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateDelEntries()

template<uint8_t Dim, class Component, class Id>
void k_d_tree::DynamicKdTrees< Dim, Component, Id >::updateDelEntries ( uint8_t tree_idx)
inlineprivate

References _, del_entries, and trees.

Referenced by insert(), and shrink_to_half().

Here is the caller graph for this function:

Member Data Documentation

◆ del_entries

template<uint8_t Dim, class Component, class Id>
std::unordered_map<Id, DelEntry> k_d_tree::DynamicKdTrees< Dim, Component, Id >::del_entries
private

◆ deleted

template<uint8_t Dim, class Component, class Id>
size_t k_d_tree::DynamicKdTrees< Dim, Component, Id >::deleted = 0
private

Referenced by remove(), shrink_to_half(), and size().

◆ n_entries

template<uint8_t Dim, class Component, class Id>
size_t k_d_tree::DynamicKdTrees< Dim, Component, Id >::n_entries = 0
private

Referenced by insert(), remove(), shrink_to_half(), and size().

◆ trees

template<uint8_t Dim, class Component, class Id>
std::vector<Tree> k_d_tree::DynamicKdTrees< Dim, Component, Id >::trees
private

The documentation for this class was generated from the following file: