|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CQuadTree Template Class Referenceclass: CQuadTree.
More...
#include <quad_tree.h>
Collaboration diagram for NL3D::CQuadTree:
[legend]List of all members.
Detailed Description
template<class T> template class NL3D::CQuadTree
class: CQuadTree.
A template CQuadTree.
This first implementation support real-time quad node split, but never merge the quad node. The possibility to merge (delete) empty quads, when an element erase occurs, will be added later.
The quadtree is geometrically delimited. By default, his size is 1*1, centered on (0,0,0). If an element which is out this zone is inserted, then it will ALWAYS be considered selected in select*() methods. By default, the quad tree is aligned on XZ.
Sample code using CQuadTree:
CQuadTree<myType> quadTree;
CVector minPoint[elementCount]=...;
CVector maxPoint[elementCount]=...;
myType value[elementCount]=...;
quadTree.create (6, CVector (0.f, 0.f, 0.f), 10.f);
for (int i=0; i<elementCount; i++)
quadTree.insert (minPoint[i], maxPoint[i], value[i]);
quadTree.clearSelection ();
quadTree.selectRay (CVector (0,0,0), CVector (1,0,0));
CQuadTree<myType>::CIterator it=quadTree.begin();
while (it!=quadTree.end())
{
it++;
}
Definition at line 96 of file quad_tree.h.
Constructor & Destructor Documentation
template<classT> |
NL3D::CQuadTree< T >::CQuadTree<T> (
|
)
|
|
|
Default constructor, use axes XZ.
Definition at line 658 of file quad_tree.h. |
template<classT> |
NL3D::CQuadTree<T>::~CQuadTree<T> (
|
)
|
|
Member Function Documentation
template<classT> |
CQuadTree< T >::CIterator NL3D::CQuadTree< T >::begin (
|
void )
|
|
|
Return the first iterator of the selected element list.
begin and end are valid till the next insert.
Definition at line 884 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::changeBase (
|
const NLMISC::CMatrix & base )
|
|
|
Change the base matrix of the quad tree.
For exemple this code init the quad tree in the plane XY: -
Parameters:
-
base
|
Base of the quad tree |
Definition at line 669 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::clear (
|
)
|
|
|
Clear the container. Elements are deleted, and the quadtree too (create() is undone).
Definition at line 679 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::clearSelection (
|
)
|
|
template<classT> |
void NL3D::CQuadTree< T >::create (
|
uint DepthMax,
|
|
const NLMISC::CVector & center,
|
|
float size )
|
|
|
Init the container.
-
Parameters:
-
DepthMax
|
is the max depth in the tree. The max cell count is (1<<DepthMax)^2 |
center
|
is the center of the quad tree |
size
|
is the width and the height of the initial quad tree. |
Definition at line 685 of file quad_tree.h. |
template<classT> |
CQuadTree< T >::CIterator NL3D::CQuadTree< T >::end (
|
void )
|
|
|
Return the end iterator of the selected element list.
begin and end are valid till the next insert.
Definition at line 889 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::erase (
|
CIterator it )
|
|
|
Erase an interator from the container.
-
Parameters:
-
it
|
is the iterator to erase. |
Definition at line 723 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::eraseAll (
|
)
|
|
|
Erase all elements from the container.
Definition at line 704 of file quad_tree.h. |
|
Insert a new element in the container.
The bounding box of the element MUST be included in the bounding box of the quadtree. -
Parameters:
-
bboxmin
|
is the corner of the bounding box of the element to insert with minimal coordinates. |
bboxmax
|
is the corner of the bounding box of the element to insert with maximal coordinates. |
val
|
is a reference on the value to insert |
Definition at line 736 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::select (
|
const std::vector< NLMISC::CPlane >& BVolume )
|
|
|
Select element with multiple planes.
Intersect with a polytope convex made of planes. The normals of planes must be directed outwards the polytope. -
Parameters:
-
BVolume
|
is a plane vector |
Definition at line 804 of file quad_tree.h. |
|
Select element intersecting a bounding box.
-
Parameters:
-
bboxmin
|
is the corner of the bounding box used to select |
bboxmax
|
is the corner of the bounding box used to select |
Definition at line 793 of file quad_tree.h. |
template<classT> |
void NL3D::CQuadTree< T >::selectAll (
|
)
|
|
|
Select element with a ray.
-
Parameters:
-
source
|
is a point in the ray |
dir
|
is the direction off the ray |
Definition at line 817 of file quad_tree.h. |
|
Select element with a segment.
-
Parameters:
-
source
|
is the source of the segment |
dest
|
is the destination of the segment |
Definition at line 848 of file quad_tree.h. |
Friends And Related Function Documentation
template<classT> |
class CConstIterator [friend]
|
|
template<classT> |
class CIterator [friend]
|
|
Member Data Documentation
template<classT> |
NLMISC::CMatrix NL3D::CQuadTree<T>::_ChangeBasis [private]
|
|
template<classT> |
uint NL3D::CQuadTree<T>::_DepthMax [private]
|
|
template<classT> |
CQuadNode NL3D::CQuadTree<T>::_QuadRoot [private]
|
|
template<classT> |
CBaseNode NL3D::CQuadTree<T>::_Selection [private]
|
|
template<classT> |
float NL3D::CQuadTree<T>::_Size [private]
|
|
The documentation for this class was generated from the following file:
|
|