Library of Assembled Shared Sources
|
A spatial container for generic objects. More...
#include <quad_tree_helper.h>
Public Member Functions | |
QuadTree (const TAabb &aabb, const TSplitHeuristics &heuristics=TSplitHeuristics(defaultMaxObjectsPerLeaf, defaultMaxDepth)) | |
empty quadtree with fixed bounding box | |
QuadTree (const TAabb &aabb, TObjectIterator end, const TSplitHeuristics &heuristics=TSplitHeuristics(defaultMaxObjectsPerLeaf, defaultMaxDepth)) | |
empty quadtree with fixed bounding box and end iterator. | |
QuadTree (TObjectIterator first, TObjectIterator last, const TSplitHeuristics &heuristics=TSplitHeuristics(defaultMaxObjectsPerLeaf, defaultMaxDepth)) | |
quadtree from objects, with computed bounding box | |
QuadTree (TSelf &&other) noexcept | |
move constructor | |
TSelf & | operator= (TSelf &&other) noexcept |
move constructor | |
bool | contains (const TPoint &p, const TInfo *info=0) const |
return true if any of the objects contains point. | |
template<typename OutputIterator> | |
OutputIterator | find (const TPoint &p, OutputIterator result, const TInfo *info=0) const |
find objects containing point and write them to the output iterator. | |
template<typename OutputIterator> | |
OutputIterator | find (const TAabb &box, OutputIterator result, const TInfo *info=0) const |
template<typename OutputIterator> | |
OutputIterator | find (const TRay &ray, TParam minT, TParam maxT, OutputIterator result, const TInfo *info=0) const |
void | add (TObjectIterator object) |
contains. | |
size_t | depth () const |
depth. | |
A spatial container for generic objects.
The object needs a traits class which contains the necessary functions to perform the quad tree management for the particular ObjectType. The traits class needs as a basis the following interface: static TAabb aabb(const TSimplePolygon3D& iP); static bool contains( const TSimplePolygon3D& iP, const TPoint& point)
The above functions are only examples. The dimensionality of the primitives must match but can be of any order. So the quad tree can be used to classify in 2 and 3 dimensions. In three dimensions the more common name is OctTree.
Higher level divisions can in theory be supported but the dimensional specific part must be reimplemented. Altough this is only 2 functions and could be written generally this is not yet available.
a Quad tree for general objects
Definition at line 85 of file quad_tree.h.
bool lass::spat::QuadTree< O, OT, SH >::contains | ( | const TPoint & | p, |
const TInfo * | info = 0 ) const |
return true if any of the objects contains point.
Required : static bool ObjectTypeTraits::contains( const Object& object, const TPoint& point, const TInfo* info );
Definition at line 244 of file quad_tree.inl.
OutputIterator lass::spat::QuadTree< O, OT, SH >::find | ( | const TPoint & | p, |
OutputIterator | result, | ||
const TInfo * | info = 0 ) const |
find objects containing point and write them to the output iterator.
Required : static bool ObjectTypeTraits::contains( const Object& object, const TPoint& point, const TInfo* info );
Definition at line 277 of file quad_tree.inl.
OutputIterator lass::spat::QuadTree< O, OT, SH >::find | ( | const TAabb & | box, |
OutputIterator | result, | ||
const TInfo * | info = 0 ) const |
Definition at line 313 of file quad_tree.inl.
OutputIterator lass::spat::QuadTree< O, OT, SH >::find | ( | const TRay & | ray, |
TParam | tMin, | ||
TParam | tMax, | ||
OutputIterator | result, | ||
const TInfo * | info = 0 ) const |
Definition at line 330 of file quad_tree.inl.
void lass::spat::QuadTree< O, OT, SH >::add | ( | TObjectIterator | object | ) |
contains.
Returns the number of object that returned sFront on all the lines provided in the iFrustum vector and adds them to the vector oObjects. An example of use is frustum culling.
Required : static bool ObjectTypeTraits::contains( const Object& object, const TPoint& point );
Definition at line 218 of file quad_tree.inl.
size_t lass::spat::QuadTree< O, OT, SH >::depth | ( | ) | const |