|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Orthtree-based space subdivision structure, optimized for intersection queries between axis-aligned boxes. More...
#include <GREM/core/data/LooseOrthtree.hpp>
Public Types | |
| using | value_type = T |
| Value type of the container. | |
| using | reference = T& |
| Reference type of the container. | |
| using | const_reference = const T& |
| Const reference type of the container. | |
| using | pointer = T* |
| Pointer type of the container. | |
| using | const_pointer = const T* |
| Const pointer type of the container. | |
| using | size_type = size_t |
| Size type of the container. | |
| using | difference_type = ptrdiff_t |
| Difference type of the container. | |
| using | iterator = Iterator<false> |
| Iterator type of the container. | |
| using | const_iterator = Iterator<true> |
| Const iterator type of the container. | |
| using | local_iterator = LocalIterator<false> |
| Local iterator type for the nodes of the container. | |
| using | const_local_iterator = LocalIterator<true> |
| Const local iterator type for the nodes of the container. | |
Public Member Functions | |
| LooseOrthtree () noexcept | |
| Construct an invalid tree that must be reset with valid world parameters before use. | |
| LooseOrthtree (const Box< N, Scalar > &worldBoundingBox, Scalar minOrthantSize) noexcept | |
| Construct an empty tree. | |
| void | reset (const Box< N, Scalar > &newWorldBoundingBox, Scalar newMinOrthantSize) noexcept |
| Reset the tree to an empty state with new world parameters. | |
| void | clear () noexcept |
| Erase all inserted elements from the tree. | |
| Scalar | getMinOrthantSize () const noexcept |
| Get the current minimum orthant size of the tree. | |
| Box< N, Scalar > | getRootBox () const noexcept |
| Get the current root box of the tree. | |
| iterator | begin () noexcept |
| Get the begin iterator of the elements in the tree. | |
| const_iterator | begin () const noexcept |
| Get the begin iterator of the elements in the tree. | |
| const_iterator | cbegin () const noexcept |
| Get the begin iterator of the elements in the tree. | |
| iterator | end () noexcept |
| Get the end iterator of the elements in the tree. | |
| const_iterator | end () const noexcept |
| Get the end iterator of the elements in the tree. | |
| const_iterator | cend () const noexcept |
| Get the end iterator of the elements in the tree. | |
| size_type | size () const noexcept |
| Get the number of elements in the tree. | |
| bool | empty () const noexcept |
| Check whether the tree is empty or not. | |
| template<typename... Args> | |
| iterator | emplace (const Box< N, Scalar > &elementBoundingBox, Args &&... args) |
| Construct a new element in the tree. | |
| iterator | insert (const Box< N, Scalar > &elementBoundingBox, const T &value) |
| Copy an element into the tree. | |
| iterator | insert (const Box< N, Scalar > &elementBoundingBox, T &&value) |
| Move an element into the tree. | |
| iterator | erase (const_iterator pos) |
| Remove an element from the tree. | |
| void | erase (LooseOrthtreeID id) |
| Remove an element from the tree. | |
| reference | operator[] (LooseOrthtreeID id) |
| Get the element with a specific handle. | |
| const_reference | operator[] (LooseOrthtreeID id) const |
| Get the element with a specific handle. | |
| template<typename Callback, typename Predicate> | |
| auto | traverseNodes (Callback &&callback, Predicate &&predicate) const |
| Execute a callback function for each active node of the tree, including empty internal nodes without an element. | |
| template<typename Callback> | |
| auto | traverseNodes (Callback &&callback) const |
| Execute a callback function for each active node of the tree, including empty internal nodes without an element. | |
| template<typename Callback, typename Predicate> | |
| auto | traverseElements (Callback &&callback, Predicate &&predicate) const |
| Execute a callback function for each element in the tree. | |
| template<typename Callback> | |
| auto | traverseElements (Callback &&callback) const |
| Execute a callback function for each element in the tree. | |
| template<typename Callback> | |
| auto | test (Point< N, Scalar > point, Callback &&callback) const |
| Execute a callback function for each element in the tree that might contain a given point. | |
| bool | test (Point< N, Scalar > point) const noexcept |
| Check if it is possible that some element in the tree contains a given point. | |
| template<typename Callback> | |
| auto | test (const Box< N, Scalar > &box, Callback &&callback) const |
| Execute a callback function for each element in the tree that might be intersecting with a given axis-aligned box. | |
| bool | test (const Box< N, Scalar > &box) const noexcept |
| Check if it is possible that some element in the tree is intersecting with a given axis-aligned box. | |
Friends | |
| template<typename U> | |
| size_type | erase (LooseOrthtree &c, const U &value) |
| template<typename Predicate> | |
| size_type | erase_if (LooseOrthtree &c, Predicate predicate) |
Orthtree-based space subdivision structure, optimized for intersection queries between axis-aligned boxes.
| N | number of vector dimensions (must be 2 or 3). |
| Scalar | scalar type of the axis-aligned boxes stored in the tree. |
| T | type of element to store in the tree. |
| using grem::LooseOrthtree< N, Scalar, T >::value_type = T |
Value type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::reference = T& |
Reference type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::const_reference = const T& |
Const reference type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::pointer = T* |
Pointer type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::const_pointer = const T* |
Const pointer type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::size_type = size_t |
Size type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::difference_type = ptrdiff_t |
Difference type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::iterator = Iterator<false> |
Iterator type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::const_iterator = Iterator<true> |
Const iterator type of the container.
| using grem::LooseOrthtree< N, Scalar, T >::local_iterator = LocalIterator<false> |
Local iterator type for the nodes of the container.
| using grem::LooseOrthtree< N, Scalar, T >::const_local_iterator = LocalIterator<true> |
Const local iterator type for the nodes of the container.
|
inlinenoexcept |
Construct an invalid tree that must be reset with valid world parameters before use.
|
inlinenoexcept |
Construct an empty tree.
| worldBoundingBox | bounding box of the world, or the full region that contains all other possible axis-aligned boxes that may be inserted into the tree. |
| minOrthantSize | minimum threshold for the size of a leaf orthant. This should correspond roughly to the typical width of the boxes that will be inserted into the tree. |
|
inlinenoexcept |
Reset the tree to an empty state with new world parameters.
| newWorldBoundingBox | bounding box of the world, or the full region that contains all other possible axis-aligned boxes that may be inserted into the tree. |
| newMinOrthantSize | minimum threshold for the size of a leaf orthant. This should correspond roughly to the typical width of the boxes that will be inserted into the tree. |
|
inlinenoexcept |
|
inlinenodiscardnoexcept |
Get the current minimum orthant size of the tree.
|
inlinenodiscardnoexcept |
Get the current root box of the tree.
|
inlinenodiscardnoexcept |
Get the begin iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the begin iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the begin iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the end iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the end iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the end iterator of the elements in the tree.
|
inlinenodiscardnoexcept |
Get the number of elements in the tree.
|
inlinenodiscardnoexcept |
Check whether the tree is empty or not.
|
inline |
Construct a new element in the tree.
| elementBoundingBox | axis-aligned bounding box of the element. |
| args | constructor arguments for the new element. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the element constructor. |
|
inline |
Copy an element into the tree.
| elementBoundingBox | axis-aligned bounding box of the element. |
| value | value to be copied into the tree. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the element copy constructor. |
|
inline |
Move an element into the tree.
| elementBoundingBox | axis-aligned bounding box of the element. |
| value | value to be moved into the tree. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the element move constructor. |
|
inline |
Remove an element from the tree.
| pos | iterator to the element to remove. Must be valid. |
|
inline |
Remove an element from the tree.
| id | handle to the element to remove. Must be valid. |
|
inlinenodiscard |
Get the element with a specific handle.
| id | handle to the element to get. Must be valid. |
|
inlinenodiscard |
Get the element with a specific handle.
| id | handle to the element to get. Must be valid. |
|
inline |
Execute a callback function for each active node of the tree, including empty internal nodes without an element.
| callback | function to execute, which should accept the following parameters (though they don't need to be used):
|
| predicate | condition that must be met in order to traverse deeper into the tree. Must return bool and accept the following parameter:
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback or predicate functions. |
|
inline |
Execute a callback function for each active node of the tree, including empty internal nodes without an element.
| callback | function to execute, which should accept the following parameters (though they don't need to be used):
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback function. |
|
inline |
Execute a callback function for each element in the tree.
| callback | function to execute, which should accept the following parameter:
|
| predicate | condition that must be met in order to traverse deeper into the tree. Must return bool and accept the following parameter:
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback or predicate functions. |
|
inline |
Execute a callback function for each element in the tree.
| callback | function to execute, which should accept the following parameter:
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback function. |
|
inline |
Execute a callback function for each element in the tree that might contain a given point.
| point | point to test. |
| callback | function to execute, which should accept the following parameter:
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback function. |
|
inlinenodiscardnoexcept |
Check if it is possible that some element in the tree contains a given point.
| point | point to test. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inline |
Execute a callback function for each element in the tree that might be intersecting with a given axis-aligned box.
| box | box to test. |
| callback | function to execute, which should accept the following parameter:
|
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback function. |
|
inlinenodiscardnoexcept |
Check if it is possible that some element in the tree is intersecting with a given axis-aligned box.
| box | box to test. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
friend |
|
friend |