6 #ifndef spatialSubdivision_H_
7 #define spatialSubdivision_H_
12 #include <vlutil/vlConfig.h>
17 #include <vlutil/vlPrint.h>
168 template <
typename T>
251 virtual void clear();
262 virtual bool empty()
const;
265 virtual unsigned int size()
const;
330 virtual double cellDx()
const;
331 virtual double cellDy()
const;
332 virtual double cellDz()
const;
439 #define SPATIALSUBDIVISION_HEADER
440 #include "geometry/spatialSubdivision.inl"
441 #undef SPATIALSUBDIVISION_HEADER
double inverseCellDx() const
virtual ~DtSpatialSubdivision()
Destructor.
virtual bool indicesAreValid(DtSpatialSubCellIndex xIndex, DtSpatialSubCellIndex yIndex, DtSpatialSubCellIndex zIndex) const
double myMaxOffsetY
These are the maximum sizes, in each dimension, of any offset that is to be translated into and index...
Definition: spatialSubdivision.h:423
unsigned int myCellCountX
Definition: spatialSubdivision.h:402
virtual void offsetToIndices(const DtPoint &offset, DtSpatialSubCellIndex &xIndex, DtSpatialSubCellIndex &yIndex, DtSpatialSubCellIndex &zIndex) const
Given an offset vector (local coordinate - origin), return the cell index values. ...
double myCellDz
Definition: spatialSubdivision.h:408
void calculateInverseDeltas()
Calculates the inverse of the cell deltas in each dimension. Used every time an index is calculated f...
double myInverseCellDx
These are used instead of dividing when calculating indexes from an offset.
Definition: spatialSubdivision.h:412
voidpf uLong int origin
Definition: ioapi.h:42
void calculateMinMaxOffsets()
Calculates the minimum and maximum sizes, in each dimension, of any offset that is to be translated i...
virtual DtSpatialSubIter begin()
virtual int sizeInBytes() const
virtual bool empty() const
virtual unsigned int cellCountZ() const
virtual const DtPoint & origin() const
Get/Set the origin of the spatial index (the point of lowest X, Y, Z)
double myMaxOffsetZ
These are the maximum sizes, in each dimension, of any offset that is to be translated into and index...
Definition: spatialSubdivision.h:424
DtSpatialSubdivision(const DtPoint &origin, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ, double cellDx, double cellDy, double cellDz)
Intended default constructor.
unsigned int myCellCountY
Definition: spatialSubdivision.h:403
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
double myMaxOffsetX
These are the maximum sizes, in each dimension, of any offset that is to be translated into and index...
Definition: spatialSubdivision.h:422
virtual bool indexIsValid(DtSpatialSubCellIndex index) const
Check if the given index values are within the spatial subdivision.
bool testInvariant() const
Tests the class invariant. Called at the beginning of every public member function and at the end of ...
double myCellDy
Definition: spatialSubdivision.h:407
virtual DtSpatialSubCellType & operator[](DtSpatialSubCellIndex index)
std::vector< DtSpatialSubCellType > myCells
Definition: spatialSubdivision.h:431
virtual void resize(DtExtent extent, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ)
Resizes the spatial subdivision to fit the specified extent. This function clears the contents of the...
double myInverseCellDz
These are used instead of dividing when calculating indexes from an offset.
Definition: spatialSubdivision.h:414
double inverseCellDz() const
virtual void clear()
Empties the entire spatial subdivision, removing all contents.
double inverseCellDy() const
virtual void setResolutions(unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ=1)
Warning: clears all contents! Resets the cell counts of the spatial subdivision to the specified valu...
double myMinOffsetZ
Definition: spatialSubdivision.h:429
virtual double cellDx() const
double myMinOffsetY
Definition: spatialSubdivision.h:428
int DtSpatialSubCellIndex
As this is a 3D grid, cells can be addressed by indices as well.
Definition: spatialSubdivision.h:180
virtual unsigned int cellCountX() const
double myInverseCellDy
These are used instead of dividing when calculating indexes from an offset.
Definition: spatialSubdivision.h:413
virtual double cellDz() const
DtSpatialSubCellType::const_iterator DtSpatialSubCellConstIter
Typedefs for the containers used to hold the contained elements.
Definition: spatialSubdivision.h:176
virtual DtSpatialSubCellType & front()
virtual void setOrigin(const DtPoint &newOrigin)
Get/Set the origin of the spatial index (the point of lowest X, Y, Z)
DtSpatialSubCellType::iterator DtSpatialSubCellIter
Typedefs for the containers used to hold the contained elements.
Definition: spatialSubdivision.h:175
double myCellDx
Definition: spatialSubdivision.h:406
Contains the declaration of the DtExtent class.
virtual unsigned int cellCountY() const
The DtSpatialSubdivision class represents a uniform spatial container. The container is divided up in...
Definition: spatialSubdivision.h:169
virtual void setExtent(DtExtent extent)
Resizes the spatial subdivision to fit the specified extent. This function clears the contents of the...
virtual double cellDy() const
std::vector< DtSpatialSubCellType >::const_iterator DtSpatialSubConstIter
Iterator into the spatial subdivision's cells.
Definition: spatialSubdivision.h:185
virtual void clearCell(DtSpatialSubIter &cellIter)
Clears the cells referenced by the specified iterators.
virtual unsigned int size() const
voidpf uLong offset
Definition: ioapi.h:42
unsigned int myCellCountZ
Definition: spatialSubdivision.h:404
virtual DtSpatialSubCellType & at(DtSpatialSubCellIndex index)
std::vector< DtSpatialSubCellType >::iterator DtSpatialSubIter
Iterator into the spatial subdivision's cells.
Definition: spatialSubdivision.h:184
std::list< T > DtSpatialSubCellType
Typedefs for the containers used to hold the contained elements.
Definition: spatialSubdivision.h:174
DtPoint myOrigin
Definition: spatialSubdivision.h:400
virtual DtSpatialSubIter end()
virtual bool cell(double x, double y, double z, DtSpatialSubCellType *&cell)
Get the cell that contains the given coordinate if the coordinate lies within the spatial subdivision...
double myMinOffsetX
Definition: spatialSubdivision.h:427
virtual DtSpatialSubCellType & back()