From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/class_NL3D__CQuadGrid.html | 1039 +++++++++++++++++++++++++++ 1 file changed, 1039 insertions(+) create mode 100644 docs/doxygen/nel/class_NL3D__CQuadGrid.html (limited to 'docs/doxygen/nel/class_NL3D__CQuadGrid.html') diff --git a/docs/doxygen/nel/class_NL3D__CQuadGrid.html b/docs/doxygen/nel/class_NL3D__CQuadGrid.html new file mode 100644 index 00000000..71d37728 --- /dev/null +++ b/docs/doxygen/nel/class_NL3D__CQuadGrid.html @@ -0,0 +1,1039 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

NL3D::CQuadGrid Template Class Reference

This container is a simple grid, used to quickly find elements. +More... +

+#include <quad_grid.h> +

+Collaboration diagram for NL3D::CQuadGrid:

Collaboration graph
+ + + + + +
[legend]
List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Methods

 CQuadGrid ()
 Default constructor, use axes XY!!!, has a size of 16, and EltSize is 1. More...

 ~CQuadGrid ()
 dtor. More...

Initialization
void changeBase (const NLMISC::CMatrix& base)
 Change the base matrix of the quad grid. More...

void create (uint size, float eltSize)
 Init the container. More...

Container operation
void clear ()
 Clear the container. Elements are deleted, but the quadgrid is not erased. More...

CIterator erase (CIterator it)
 Erase an interator from the container. More...

CIterator insert (const NLMISC::CVector &bboxmin, const NLMISC::CVector &bboxmax, const T &val)
 Insert a new element in the container. More...

Selection
void clearSelection ()
 Clear the selection list. More...

void selectAll ()
 Select all the container. More...

void select (const NLMISC::CVector &bboxmin, const NLMISC::CVector &bboxmax)
 Select element intersecting a bounding box. More...

CIterator begin ()
 Return the first iterator of the selected element list. More...

CIterator end ()
 Return the end iterator of the selected element list. More...


Private Methods

void selectQuads (CVector bmin, CVector bmax, sint &x0, sint &x1, sint &y0, sint &y1)
void addToSelection (CNode *ptr)
void addQuadNodeToSelection (CQuadNode &quad)

Private Attributes

std::vector<CQuadNode_Grid
sint _Size
sint _SizePower
float _EltSize
NLMISC::CMatrix _ChangeBasis
CBaseNode _Selection

Friends

class  CIterator
+

Detailed Description

+

template<class T> template class NL3D::CQuadGrid

+ +This container is a simple grid, used to quickly find elements. +

+His purpose is similiar to CQuadTree, but it is a simple grid, so test are in O(1), not in O(log n). It is perfect for local lookup (like in collisions). Use it if you want to select small area, not large. Also, for best use, elements should have approximatively the same size, and this size should be little smaller than the size of a grid element... +

+By default, the quad grid is aligned on XY. (unlike the quadtree!!!) +

+Unlike the quadtree, the quadgrid is NOT geographicly delimited, ie, its limits "tiles"!! This is why no "center" is required. As a direct consequence, when you select something, you are REALLY not sure that what you select is not a mile away from your selection :) .... +

+Also, for memory optimisation, no bbox is stored in the quadgrid. Hence no particular selection is made on the Z components... +

+

+Author(s):
+ Lionel Berenguier , Nevrax France
+Date:
+ 2000
+

+ +

+Definition at line 64 of file quad_grid.h.


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+NL3D::CQuadGrid< T >::CQuadGrid<T> ( + +) +
+
+ + + + + +
+   + + +

+Default constructor, use axes XY!!!, has a size of 16, and EltSize is 1. +

+ +

+Definition at line 332 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+NL3D::CQuadGrid< T >::~CQuadGrid<T> ( + +) +
+
+ + + + + +
+   + + +

+dtor. +

+ +

+Definition at line 340 of file quad_grid.h.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid<T>::addQuadNodeToSelection ( + +CQuadNode & quad ) [inline, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 242 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid<T>::addToSelection ( + +CNode * ptr ) [inline, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 228 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+CQuadGrid< T >::CIterator NL3D::CQuadGrid< T >::begin ( + +void ) +
+
+ + + + + +
+   + + +

+Return the first iterator of the selected element list. +

+begin and end are valid till the next insert. +

+Definition at line 528 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::changeBase ( + +const NLMISC::CMatrix & base ) +
+
+ + + + + +
+   + + +

+Change the base matrix of the quad grid. +

+For exemple this code init the grid tree in the plane XZ:

 CQuadGrid                      grid;
+ NLMISC::CMatrix                tmp;
+ NLMISC::CVector                I(1,0,0);
+ NLMISC::CVector                J(0,0,1);
+ NLMISC::CVector                K(0,-1,0);
+ 
+ tmp.identity();
+ tmp.setRot(I,J,K, true);
+ quadTree.changeBase (tmp);
+Parameters:
+ + +
base + Base of the quad grid
+
+

+Definition at line 345 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::clear ( + +) +
+
+ + + + + +
+   + + +

+Clear the container. Elements are deleted, but the quadgrid is not erased. +

+ +

+Definition at line 371 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::clearSelection ( + +) +
+
+ + + + + +
+   + + +

+Clear the selection list. +

+ +

+Definition at line 476 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::create ( + +uint size, +
+float eltSize ) +
+
+ + + + + +
+   + + +

+Init the container. +

+container is first clear() ed.

+Parameters:
+ + + +
size + is the width and the height of the initial quad tree, in number of square. For performance view, this should be a power of 2, and <=32768. (eg: 256,512, 8, 16 ...)
eltSize + is the width and height of an element. Must be >0. Notice that the quadgrid MUST be square!!
+
+

+Definition at line 350 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+CQuadGrid< T >::CIterator NL3D::CQuadGrid< T >::end ( + +void ) +
+
+ + + + + +
+   + + +

+Return the end iterator of the selected element list. +

+begin and end are valid till the next insert. +

+Definition at line 533 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+CQuadGrid< T >::CIterator NL3D::CQuadGrid< T >::erase ( + +CIterator it ) +
+
+ + + + + +
+   + + +

+Erase an interator from the container. +

+

+Parameters:
+ + +
it + is the iterator to erase.
+
+Returns:
+ if element is currently selected, the next selected element is returned, (or end()). if the element is not selected, end() is returned.
+

+Definition at line 384 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + + + + + + + + + +
+template<classT>
+CQuadGrid< T >::CIterator NL3D::CQuadGrid< T >::insert ( + +const NLMISC::CVector & bboxmin, +
+const NLMISC::CVector & bboxmax, +
+const T & val ) +
+
+ + + + + +
+   + + +

+Insert a new element in the container. +

+

+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 431 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::select ( + +const NLMISC::CVector & bboxmin, +
+const NLMISC::CVector & bboxmax ) +
+
+ + + + + +
+   + + +

+Select element intersecting a bounding box. +

+Clear the selection first.

+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 500 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid< T >::selectAll ( + +) +
+
+ + + + + +
+   + + +

+Select all the container. +

+ +

+Definition at line 490 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+template<classT>
+void NL3D::CQuadGrid<T>::selectQuads ( + +CVector bmin, +
+CVector bmax, +
+sint & x0, +
+sint & x1, +
+sint & y0, +
+sint & y1 ) [inline, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 199 of file quad_grid.h.

+


Friends And Related Function Documentation

+

+ + + + +
+ + + + + + + + +
+template<classT>
+class CIterator [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 69 of file quad_grid.h.

+


Member Data Documentation

+

+ + + + +
+ + + + + + + + +
+template<classT>
+NLMISC::CMatrix NL3D::CQuadGrid<T>::_ChangeBasis [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 191 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + +
+template<classT>
+float NL3D::CQuadGrid<T>::_EltSize [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 190 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + +
+template<classT>
+std::vector< CQuadNode > NL3D::CQuadGrid<T>::_Grid [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 187 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + +
+template<classT>
+CBaseNode NL3D::CQuadGrid<T>::_Selection [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 193 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + +
+template<classT>
+sint NL3D::CQuadGrid<T>::_Size [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 188 of file quad_grid.h.

+

+ + + + +
+ + + + + + + + +
+template<classT>
+sint NL3D::CQuadGrid<T>::_SizePower [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 189 of file quad_grid.h.

+


The documentation for this class was generated from the following file: + + + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1