Generic k-d tree structure. More...
#include <Core/Geometry/KdTree.hpp>
Classes | |
struct | Node |
Simple K-d tree node. More... | |
Public Types | |
using | Point = Vector< T, K > |
using | BBox = BoundingBox< T, K > |
using | ContainerType = std::vector< Point > |
using | Iterator = typename ContainerType::iterator |
using | ConstIterator = typename ContainerType::const_iterator |
using | NodeContainerType = std::vector< Node > |
using | NodeIterator = typename NodeContainerType::iterator |
using | ConstNodeIterator = typename NodeContainerType::const_iterator |
Public Member Functions | |
void | Build (const ConstArrayView1< Point > &points) |
Builds internal acceleration structure for given points list. More... | |
void | ForEachNearbyPoint (const Point &origin, T radius, const std::function< void(size_t, const Point &)> &callback) const |
bool | HasNearbyPoint (const Point &origin, T radius) const |
size_t | GetNearestPoint (const Point &origin) const |
Returns index of the nearest point. More... | |
Iterator | begin () |
Returns the mutable begin iterator of the item. More... | |
Iterator | end () |
Returns the mutable end iterator of the item. More... | |
ConstIterator | begin () const |
Returns the immutable begin iterator of the item. More... | |
ConstIterator | end () const |
Returns the immutable end iterator of the item. More... | |
NodeIterator | BeginNode () |
Returns the mutable begin iterator of the node. More... | |
NodeIterator | EndNode () |
Returns the mutable end iterator of the node. More... | |
ConstNodeIterator | BeginNode () const |
Returns the immutable begin iterator of the node. More... | |
ConstNodeIterator | EndNode () const |
Returns the immutable end iterator of the node. More... | |
void | Reserve (size_t numPoints, size_t numNodes) |
Reserves memory space for this tree. More... | |
Detailed Description
template<typename T, size_t K>
class CubbyFlow::KdTree< T, K >
Generic k-d tree structure.
Member Typedef Documentation
◆ BBox
using CubbyFlow::KdTree< T, K >::BBox = BoundingBox<T, K> |
◆ ConstIterator
using CubbyFlow::KdTree< T, K >::ConstIterator = typename ContainerType::const_iterator |
◆ ConstNodeIterator
using CubbyFlow::KdTree< T, K >::ConstNodeIterator = typename NodeContainerType::const_iterator |
◆ ContainerType
using CubbyFlow::KdTree< T, K >::ContainerType = std::vector<Point> |
◆ Iterator
using CubbyFlow::KdTree< T, K >::Iterator = typename ContainerType::iterator |
◆ NodeContainerType
using CubbyFlow::KdTree< T, K >::NodeContainerType = std::vector<Node> |
◆ NodeIterator
using CubbyFlow::KdTree< T, K >::NodeIterator = typename NodeContainerType::iterator |
◆ Point
using CubbyFlow::KdTree< T, K >::Point = Vector<T, K> |
Member Function Documentation
◆ begin() [1/2]
KdTree< T, K >::Iterator CubbyFlow::KdTree< T, K >::begin | ( | ) |
Returns the mutable begin iterator of the item.
◆ begin() [2/2]
KdTree< T, K >::ConstIterator CubbyFlow::KdTree< T, K >::begin | ( | ) | const |
Returns the immutable begin iterator of the item.
◆ BeginNode() [1/2]
KdTree< T, K >::NodeIterator CubbyFlow::KdTree< T, K >::BeginNode | ( | ) |
Returns the mutable begin iterator of the node.
◆ BeginNode() [2/2]
KdTree< T, K >::ConstNodeIterator CubbyFlow::KdTree< T, K >::BeginNode | ( | ) | const |
Returns the immutable begin iterator of the node.
◆ Build()
void CubbyFlow::KdTree< T, K >::Build | ( | const ConstArrayView1< Point > & | points | ) |
Builds internal acceleration structure for given points list.
◆ end() [1/2]
KdTree< T, K >::Iterator CubbyFlow::KdTree< T, K >::end | ( | ) |
Returns the mutable end iterator of the item.
◆ end() [2/2]
KdTree< T, K >::ConstIterator CubbyFlow::KdTree< T, K >::end | ( | ) | const |
Returns the immutable end iterator of the item.
◆ EndNode() [1/2]
KdTree< T, K >::NodeIterator CubbyFlow::KdTree< T, K >::EndNode | ( | ) |
Returns the mutable end iterator of the node.
◆ EndNode() [2/2]
KdTree< T, K >::ConstNodeIterator CubbyFlow::KdTree< T, K >::EndNode | ( | ) | const |
Returns the immutable end iterator of the node.
◆ ForEachNearbyPoint()
void CubbyFlow::KdTree< T, K >::ForEachNearbyPoint | ( | const Point & | origin, |
T | radius, | ||
const std::function< void(size_t, const Point &)> & | callback | ||
) | const |
Invokes the callback function for each nearby point around the origin within given radius.
- Parameters
-
[in] origin The origin position. [in] radius The search radius. [in] callback The callback function.
◆ GetNearestPoint()
size_t CubbyFlow::KdTree< T, K >::GetNearestPoint | ( | const Point & | origin | ) | const |
Returns index of the nearest point.
◆ HasNearbyPoint()
bool CubbyFlow::KdTree< T, K >::HasNearbyPoint | ( | const Point & | origin, |
T | radius | ||
) | const |
Returns true if there are any nearby points for given origin within radius.
- Parameters
-
[in] origin The origin. [in] radius The radius.
- Returns
- True if has nearby point, false otherwise.
◆ Reserve()
void CubbyFlow::KdTree< T, K >::Reserve | ( | size_t | numPoints, |
size_t | numNodes | ||
) |
Reserves memory space for this tree.
The documentation for this class was generated from the following files:
- Core/Geometry/KdTree.hpp
- Core/Geometry/KdTree-Impl.hpp