CubbyFlow::KdTree< T, K > Class Template Referencefinal

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

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::BBox = BoundingBox<T, K>

◆ ConstIterator

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::ConstIterator = typename ContainerType::const_iterator

◆ ConstNodeIterator

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::ConstNodeIterator = typename NodeContainerType::const_iterator

◆ ContainerType

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::ContainerType = std::vector<Point>

◆ Iterator

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::Iterator = typename ContainerType::iterator

◆ NodeContainerType

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::NodeContainerType = std::vector<Node>

◆ NodeIterator

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::NodeIterator = typename NodeContainerType::iterator

◆ Point

template<typename T, size_t K>
using CubbyFlow::KdTree< T, K >::Point = Vector<T, K>

Member Function Documentation

◆ begin() [1/2]

template<typename T , size_t K>
KdTree< T, K >::Iterator CubbyFlow::KdTree< T, K >::begin ( )

Returns the mutable begin iterator of the item.

◆ begin() [2/2]

template<typename T , size_t K>
KdTree< T, K >::ConstIterator CubbyFlow::KdTree< T, K >::begin ( ) const

Returns the immutable begin iterator of the item.

◆ BeginNode() [1/2]

template<typename T , size_t K>
KdTree< T, K >::NodeIterator CubbyFlow::KdTree< T, K >::BeginNode ( )

Returns the mutable begin iterator of the node.

◆ BeginNode() [2/2]

template<typename T , size_t K>
KdTree< T, K >::ConstNodeIterator CubbyFlow::KdTree< T, K >::BeginNode ( ) const

Returns the immutable begin iterator of the node.

◆ Build()

template<typename T , size_t K>
void CubbyFlow::KdTree< T, K >::Build ( const ConstArrayView1< Point > &  points)

Builds internal acceleration structure for given points list.

◆ end() [1/2]

template<typename T , size_t K>
KdTree< T, K >::Iterator CubbyFlow::KdTree< T, K >::end ( )

Returns the mutable end iterator of the item.

◆ end() [2/2]

template<typename T , size_t K>
KdTree< T, K >::ConstIterator CubbyFlow::KdTree< T, K >::end ( ) const

Returns the immutable end iterator of the item.

◆ EndNode() [1/2]

template<typename T , size_t K>
KdTree< T, K >::NodeIterator CubbyFlow::KdTree< T, K >::EndNode ( )

Returns the mutable end iterator of the node.

◆ EndNode() [2/2]

template<typename T , size_t K>
KdTree< T, K >::ConstNodeIterator CubbyFlow::KdTree< T, K >::EndNode ( ) const

Returns the immutable end iterator of the node.

◆ ForEachNearbyPoint()

template<typename T, size_t K>
void CubbyFlow::KdTree< T, K >::ForEachNearbyPoint ( const Point origin,
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]originThe origin position.
[in]radiusThe search radius.
[in]callbackThe callback function.

◆ GetNearestPoint()

template<typename T , size_t K>
size_t CubbyFlow::KdTree< T, K >::GetNearestPoint ( const Point origin) const

Returns index of the nearest point.

◆ HasNearbyPoint()

template<typename T, size_t K>
bool CubbyFlow::KdTree< T, K >::HasNearbyPoint ( const Point origin,
radius 
) const

Returns true if there are any nearby points for given origin within radius.

Parameters
[in]originThe origin.
[in]radiusThe radius.
Returns
True if has nearby point, false otherwise.

◆ Reserve()

template<typename T , size_t K>
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: