Gamedev Framework (gf)  0.10.0
A C++14 framework for 2D games
Classes | Public Member Functions | List of all members
gf::RStarTree< T, U, N, MaxSize, MinSize > Class Template Reference

An implemntation of a R* tree. More...

#include <gf/Spatial.h>

Public Member Functions

 RStarTree ()
 Constructor. More...
 
 RStarTree (const RStarTree &)=delete
 Deleted copy constructor. More...
 
RStarTreeoperator= (const RStarTree &)=delete
 Deleted copy assignement. More...
 
 RStarTree (RStarTree &&other) noexcept
 Move constructor. More...
 
RStarTreeoperator= (RStarTree &&other) noexcept
 Move assignement. More...
 
 ~RStarTree ()
 Destructor. More...
 
bool insert (T value, const Box< U, N > &bounds)
 Insert an object in the tree. More...
 
std::size_t query (const Box< U, N > &bounds, SpatialQueryCallback< T > callback, SpatialQuery kind=SpatialQuery::Intersect) const
 Query objects in the tree. More...
 
void clear ()
 Remove all the objects from the tree. More...
 
std::vector< SpatialStructure< U, N > > getStructure () const
 

Detailed Description

template<typename T, typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
class gf::RStarTree< T, U, N, MaxSize, MinSize >

An implemntation of a R* tree.

More precisely, this class implements the Revised R* tree.

See also
gf::QuadTree
R* tree - Wikipedia

Constructor & Destructor Documentation

◆ RStarTree() [1/3]

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
gf::RStarTree< T, U, N, MaxSize, MinSize >::RStarTree ( )
inline

Constructor.

◆ RStarTree() [2/3]

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
gf::RStarTree< T, U, N, MaxSize, MinSize >::RStarTree ( const RStarTree< T, U, N, MaxSize, MinSize > &  )
delete

Deleted copy constructor.

◆ RStarTree() [3/3]

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
gf::RStarTree< T, U, N, MaxSize, MinSize >::RStarTree ( RStarTree< T, U, N, MaxSize, MinSize > &&  other)
inlinenoexcept

Move constructor.

◆ ~RStarTree()

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
gf::RStarTree< T, U, N, MaxSize, MinSize >::~RStarTree ( )
inline

Destructor.

Member Function Documentation

◆ clear()

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
void gf::RStarTree< T, U, N, MaxSize, MinSize >::clear ( )
inline

Remove all the objects from the tree.

◆ getStructure()

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
std::vector<SpatialStructure<U, N> > gf::RStarTree< T, U, N, MaxSize, MinSize >::getStructure ( ) const
inline

◆ insert()

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
bool gf::RStarTree< T, U, N, MaxSize, MinSize >::insert ( T  value,
const Box< U, N > &  bounds 
)
inline

Insert an object in the tree.

Parameters
valueThe object to insert
boundsThe bounds of the object
Returns
True if the object has been inserted

◆ operator=() [1/2]

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
RStarTree& gf::RStarTree< T, U, N, MaxSize, MinSize >::operator= ( const RStarTree< T, U, N, MaxSize, MinSize > &  )
delete

Deleted copy assignement.

◆ operator=() [2/2]

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
RStarTree& gf::RStarTree< T, U, N, MaxSize, MinSize >::operator= ( RStarTree< T, U, N, MaxSize, MinSize > &&  other)
inlinenoexcept

Move assignement.

◆ query()

template<typename T , typename U = float, std::size_t N = 2, std::size_t MaxSize = 16, std::size_t MinSize = 4>
std::size_t gf::RStarTree< T, U, N, MaxSize, MinSize >::query ( const Box< U, N > &  bounds,
SpatialQueryCallback< T callback,
SpatialQuery  kind = SpatialQuery::Intersect 
) const
inline

Query objects in the tree.

Parameters
boundsThe bounds of the query
callbackThe callback to apply to found objects
kindThe kind of spatial query
Returns
The number of objects found