#include <face_grid.h>
Nevrax France
Definition at line 57 of file face_grid.h.
Public Member Functions | |
| CFaceGrid () | |
| Constructor. | |
| void | clear () |
| Clear the grid. | |
| void | create (const CFaceGridBuild &fgb) |
| Create the face grid from a CFaceGridBuild. | |
| void | select (const NLMISC::CVector &pos, std::vector< uint32 > &selected) const |
| Select faces indexes close to a given point. | |
| void | serial (NLMISC::IStream &f) |
| Serial the face grid. | |
Protected Attributes | |
| float | _ElSize |
| The size (in meter) of each grid element. | |
| std::vector< uint32 > | _Grid |
| The grid of indexes to the data buffer. | |
| std::vector< uint32 > | _GridData |
| The grid data buffer (packed datas). | |
| uint16 | _Log2Width |
| The 2Log of the width of the grid. | |
| uint16 | _Width |
| The width of the grid in rows and lines. | |
|
|
Constructor.
Definition at line 102 of file face_grid.h. References _ElSize, and _Log2Width.
00102 : _Width(0), _Log2Width(0), _ElSize(0.0f) {} |
|
|
Clear the grid.
Definition at line 120 of file face_grid.h. References _ElSize, _Log2Width, and NLMISC::contReset(). Referenced by NLPACS::CLocalRetriever::clear(), and create().
00121 {
00122 _Width = 0;
00123 _Log2Width = 0;
00124 _ElSize = 0.0f;
00125 NLMISC::contReset(_Grid);
00126 NLMISC::contReset(_GridData);
00127 }
|
|
|
Create the face grid from a CFaceGridBuild.
Definition at line 129 of file face_grid.h. References _ElSize, _Log2Width, clear(), NLMISC::getPowerOf2(), NLPACS::CFaceGrid::CFaceGridBuild::Grid, nlassert, NLPACS::CFaceGrid::CFaceGridBuild::Size, uint, uint16, and NLPACS::CFaceGrid::CFaceGridBuild::Width. Referenced by NLPACS::CLocalRetriever::initFaceGrid().
00130 {
00131 nlassert(fgb.Grid.size() == fgb.Width*fgb.Width);
00132 nlassert(fgb.Width < 32768);
00133
00134 // clear first
00135 clear();
00136
00137 // setup grid size
00138 _Width = (uint16)fgb.Width;
00139 _ElSize = fgb.Size;
00140 _Log2Width = NLMISC::getPowerOf2(_Width);
00141
00142 // and store in packed format the data of the face grid build
00143 uint i;
00144 for (i=0; i<fgb.Grid.size(); ++i)
00145 {
00146 _Grid.push_back(_GridData.size());
00147 _GridData.insert(_GridData.end(), fgb.Grid[i].begin(), fgb.Grid[i].end());
00148 }
00149 }
|
|
||||||||||||
|
Select faces indexes close to a given point.
Definition at line 151 of file face_grid.h. References _ElSize, _Log2Width, sint, uint, NLMISC::CVector::x, x, NLMISC::CVector::y, and y. Referenced by NLPACS::CLocalRetriever::getHeight(), and NLPACS::CLocalRetriever::snapToInteriorGround().
00152 {
00153 selected.clear();
00154
00155 uint start, stop, idx;
00156 uint x, y;
00157
00158 x = ((sint)(pos.x/_ElSize) & (_Width-1));
00159 y = ((sint)(pos.y/_ElSize) & (_Width-1));
00160
00161 idx = x+(y<<_Log2Width);
00162
00163 start = _Grid[idx++];
00164 stop = (idx == _Grid.size()) ? _GridData.size() : _Grid[idx];
00165
00166 for (; start<stop; ++start)
00167 selected.push_back(_GridData[start]);
00168 }
|
|
|
Serial the face grid.
Definition at line 170 of file face_grid.h. References _ElSize, _Log2Width, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), and NLMISC::IStream::serialVersion().
00171 {
00172 /*
00173 Version 0:
00174 - base version
00175 */
00176 (void)f.serialVersion(0);
00177
00178 f.serial(_Width, _Log2Width, _ElSize);
00179 f.serialCont(_Grid);
00180 f.serialCont(_GridData);
00181 }
|
|
|
The size (in meter) of each grid element.
Definition at line 93 of file face_grid.h. Referenced by CFaceGrid(), clear(), create(), select(), and serial(). |
|
|
The grid of indexes to the data buffer.
Definition at line 96 of file face_grid.h. |
|
|
The grid data buffer (packed datas).
Definition at line 98 of file face_grid.h. |
|
|
The 2Log of the width of the grid.
Definition at line 90 of file face_grid.h. Referenced by CFaceGrid(), clear(), create(), select(), and serial(). |
|
|
The width of the grid in rows and lines.
Definition at line 88 of file face_grid.h. |
1.3.6