#include <UT_VoxelArray.h>
Public Member Functions | |
| UT_VoxelArrayIterator () | |
| UT_VoxelArrayIterator (UT_VoxelArray< T > *vox) | |
| UT_VoxelArrayIterator (UT_COWReadHandle< UT_VoxelArray< T > > handle) | |
| virtual | ~UT_VoxelArrayIterator () |
| void | setArray (UT_VoxelArray< T > *vox) |
| void | setHandle (UT_COWReadHandle< UT_VoxelArray< T > > handle) |
| void | setPartialRange (int idx, int numranges) |
| void | restrictToBBox (const UT_BoundingBox &bbox) |
| void | restrictToBBox (int xmin, int xmax, int ymin, int ymax, int zmin, int zmax) |
| The [xmin, xmax] are inclusive and measured in voxels. | |
| void | rewind () |
| Resets the iterator to point to the first voxel. | |
| bool | atEnd () const |
| Returns true if we have iterated over all of the voxels. | |
| void | advance () |
| Advances the iterator to point to the next voxel. | |
| int | x () const |
| Retrieve the current location of the iterator. | |
| int | y () const |
| int | z () const |
| int | idx (int idx) const |
| T | getValue () const |
| void | setValue (T t) const |
| Sets the voxel we are currently pointing to the given value. | |
| bool | isTileConstant () const |
| Returns true if the tile we are currently in is a constant tile. | |
| bool | isStartOfTile () const |
| Returns true if we are at the start of a new tile. | |
| UT_VoxelTile< T > * | getTile () const |
| Returns the VoxelTile we are currently processing. | |
| void | advanceTile () |
| bool | getCompressOnExit () const |
| void | setCompressOnExit (bool shouldcompress) |
Public Attributes | |
| int | myCurTile |
| Our current linear tile idx. A value of -1 implies at end. | |
| int | myCurTileListIdx |
| Our current index into the tile list. | |
| int | myTileStart |
| int | myTileEnd |
| int | myTilePos [3] |
| Which tile we are as per tx,ty,tz rather than linear index. | |
| int | myTileLocalPos [3] |
| Our position within the current tile. | |
| int | myTileSize [3] |
| The size of the current tile. | |
Protected Attributes | |
| UT_VoxelArray< T > * | myArray |
| The array we belong to. | |
| UT_COWReadHandle < UT_VoxelArray< T > > | myHandle |
| int | myPos [3] |
| Absolute index into voxel array. | |
| bool | myShouldCompressOnExit |
| bool | myUseTileList |
| UT_IntArray | myTileList |
This class eliminates the need for having for (z = 0; z < zres; z++) ... for (x = 0; x < xres; x++) loops everywhere.
Note that the order of iteration is undefined! (The actual order is to complete each tile in turn, thereby hopefully improving cache coherency)
It is safe to write to the voxel array while this iterator is active. It is *not* safe to resize the voxel array (or destroy it)
The iterator is similar in principal to an STL iterator, but somewhat simpler. The classic STL loop for ( it = begin(); it != end(); ++it ) is done using for ( it.rewind(); !it.atEnd(); it.advance() )
Definition at line 798 of file UT_VoxelArray.h.
| UT_VoxelArrayIterator< T >::UT_VoxelArrayIterator | ( | ) | [inline] |
Definition at line 2264 of file UT_VoxelArray.C.
| UT_VoxelArrayIterator< T >::UT_VoxelArrayIterator | ( | UT_VoxelArray< T > * | vox | ) | [inline] |
Definition at line 2274 of file UT_VoxelArray.C.
| UT_VoxelArrayIterator< T >::UT_VoxelArrayIterator | ( | UT_COWReadHandle< UT_VoxelArray< T > > | handle | ) | [inline] |
Definition at line 2282 of file UT_VoxelArray.C.
| UT_VoxelArrayIterator< T >::~UT_VoxelArrayIterator | ( | ) | [inline, virtual] |
Definition at line 2290 of file UT_VoxelArray.C.
| void UT_VoxelArrayIterator< T >::advance | ( | ) | [inline] |
Advances the iterator to point to the next voxel.
Definition at line 858 of file UT_VoxelArray.h.
| void UT_VoxelArrayIterator< T >::advanceTile | ( | ) | [inline] |
Advances the iterator to point to the next tile. Useful if the constant test showed that you didn't need to deal with this one.
Definition at line 2506 of file UT_VoxelArray.C.
| bool UT_VoxelArrayIterator< T >::atEnd | ( | ) | const [inline] |
Returns true if we have iterated over all of the voxels.
Definition at line 854 of file UT_VoxelArray.h.
| bool UT_VoxelArrayIterator< T >::getCompressOnExit | ( | ) | const [inline] |
Sets a flag which causes the iterator to tryCompress() tiles when it is done with them.
Definition at line 954 of file UT_VoxelArray.h.
| UT_VoxelTile<T>* UT_VoxelArrayIterator< T >::getTile | ( | ) | const [inline] |
| T UT_VoxelArrayIterator< T >::getValue | ( | ) | const [inline] |
Retrieves the value that we are currently pointing at. This is faster than an operator(x,y,z) as we already know our current tile and that bounds checking isn't needed.
Definition at line 898 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::idx | ( | int | idx | ) | const [inline] |
Definition at line 893 of file UT_VoxelArray.h.
| bool UT_VoxelArrayIterator< T >::isStartOfTile | ( | ) | const [inline] |
Returns true if we are at the start of a new tile.
Definition at line 936 of file UT_VoxelArray.h.
| bool UT_VoxelArrayIterator< T >::isTileConstant | ( | ) | const [inline] |
Returns true if the tile we are currently in is a constant tile.
Definition at line 925 of file UT_VoxelArray.h.
| void UT_VoxelArrayIterator< T >::restrictToBBox | ( | int | xmin, | |
| int | xmax, | |||
| int | ymin, | |||
| int | ymax, | |||
| int | zmin, | |||
| int | zmax | |||
| ) | [inline] |
The [xmin, xmax] are inclusive and measured in voxels.
Definition at line 2381 of file UT_VoxelArray.C.
| void UT_VoxelArrayIterator< T >::restrictToBBox | ( | const UT_BoundingBox & | bbox | ) | [inline] |
Restricts this iterator to the tiles that intersect the given bounding box of voxel coordinates. Note that this will not be a precise restriction as each tile is either included or not. You should setPartialRange() after setting the bbox range The bounding box is on the [0..1]^3 range.
Definition at line 2357 of file UT_VoxelArray.C.
| void UT_VoxelArrayIterator< T >::rewind | ( | ) | [inline] |
Resets the iterator to point to the first voxel.
Definition at line 2441 of file UT_VoxelArray.C.
| void UT_VoxelArrayIterator< T >::setArray | ( | UT_VoxelArray< T > * | vox | ) | [inline] |
| void UT_VoxelArrayIterator< T >::setCompressOnExit | ( | bool | shouldcompress | ) | [inline] |
| void UT_VoxelArrayIterator< T >::setHandle | ( | UT_COWReadHandle< UT_VoxelArray< T > > | handle | ) | [inline] |
Iterates over the array pointed to by the handle. Only supports read access during the iteration as it does a read lock.
Definition at line 818 of file UT_VoxelArray.h.
| void UT_VoxelArrayIterator< T >::setPartialRange | ( | int | idx, | |
| int | numranges | |||
| ) | [inline] |
Restricts this iterator to only run over a subset of the tiles. The tiles will be divided into approximately numrange equal groups, this will be the idx'th. The resulting iterator may have zero tiles.
Definition at line 2296 of file UT_VoxelArray.C.
| void UT_VoxelArrayIterator< T >::setValue | ( | T | t | ) | const [inline] |
Sets the voxel we are currently pointing to the given value.
Definition at line 911 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::x | ( | void | ) | const [inline] |
Retrieve the current location of the iterator.
Definition at line 890 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::y | ( | void | ) | const [inline] |
| int UT_VoxelArrayIterator< T >::z | ( | void | ) | const [inline] |
UT_VoxelArray<T>* UT_VoxelArrayIterator< T >::myArray [protected] |
| int UT_VoxelArrayIterator< T >::myCurTile |
Our current linear tile idx. A value of -1 implies at end.
Definition at line 977 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::myCurTileListIdx |
UT_COWReadHandle<UT_VoxelArray<T> > UT_VoxelArrayIterator< T >::myHandle [protected] |
The handle that we have locked to get our array. It is null by default which makes the lock/unlock nops.
Definition at line 963 of file UT_VoxelArray.h.
int UT_VoxelArrayIterator< T >::myPos[3] [protected] |
bool UT_VoxelArrayIterator< T >::myShouldCompressOnExit [protected] |
Flag determining if we should compress tiles whenever we advance out of them.
Definition at line 970 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::myTileEnd |
Definition at line 984 of file UT_VoxelArray.h.
UT_IntArray UT_VoxelArrayIterator< T >::myTileList [protected] |
Definition at line 973 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::myTileLocalPos[3] |
| int UT_VoxelArrayIterator< T >::myTilePos[3] |
Which tile we are as per tx,ty,tz rather than linear index.
Definition at line 987 of file UT_VoxelArray.h.
| int UT_VoxelArrayIterator< T >::myTileSize[3] |
| int UT_VoxelArrayIterator< T >::myTileStart |
Our start & end tiles for processing a subrange. The tile range is half open [start, end)
Definition at line 984 of file UT_VoxelArray.h.
bool UT_VoxelArrayIterator< T >::myUseTileList [protected] |
Definition at line 972 of file UT_VoxelArray.h.
1.5.9