#include <UT_VoxelArray.h>
Public Member Functions | |
| UT_VoxelArray () | |
| virtual | ~UT_VoxelArray () |
| UT_VoxelArray (const UT_VoxelArray< T > &src) | |
| Copy constructor:. | |
| const UT_VoxelArray< T > & | operator= (const UT_VoxelArray< T > &src) |
| Assignment operator:. | |
| void | size (int xres, int yres, int zres) |
| void | match (const UT_VoxelArray< T > &src) |
| int | getXRes () const |
| int | getYRes () const |
| int | getZRes () const |
| int | getRes (int axis) const |
| int64 | getMemoryUsage () const |
| Return the amount of memory used by this array. | |
| void | constant (T t) |
| bool | isConstant (T *cval=0) const |
| T | operator() (UT_Vector3 pos) const |
| T | evaluate (const UT_Vector3 &pos, const UT_Filter &filter, fpreal radius) const |
| void | resample (const UT_VoxelArray< T > &src, UT_FilterType filtertype=UT_FILTER_POINT) |
| bool | posToIndex (UT_Vector3 pos, int &x, int &y, int &z) const |
| bool | posToIndex (UT_Vector3 pos, UT_Vector3 &ipos) const |
| bool | indexToPos (int x, int y, int z, UT_Vector3 &pos) const |
| void | clampIndex (int &x, int &y, int &z) const |
| bool | isValidIndex (int x, int y, int z) const |
| Returns true if the given x, y, z values lie inside the valid index. | |
| T | operator() (int x, int y, int z) const |
| void | setValue (int x, int y, int z, T t) |
| T | getValue (int x, int y, int z) const |
| void | setBorder (UT_VoxelBorderType type, T t) |
| UT_VoxelBorderType | getBorder () const |
| T | getBorderValue () const |
| void | collapseAllTiles () |
| void | expandAllTiles () |
| UT_VoxelTile< T > * | getTile (int tx, int ty, int tz) const |
| UT_VoxelTile< T > * | getLinearTile (int idx) const |
| void | linearTileToXYZ (int idx, int &x, int &y, int &z) const |
| int | xyzTileToLinear (int x, int y, int z) const |
| int | getTileRes (int dim) const |
| int | numTiles () const |
| int | numVoxels () const |
| fpreal | getCompressionTolerance () const |
| void | setCompressionTolerance (fpreal tol) |
| void | saveData (ostream &os) |
| void | loadData (UT_IStream &is) |
| Load an array, requires you have already size()d this array. | |
This provides data structure to hold a three dimmensional array of data. The data should be some simple arithmatic type, such as uint8, fpreal16, or UT_Vector3.
Some operations, such as gradiants, may make less sense with uint8.
Definition at line 436 of file UT_VoxelArray.h.
| UT_VoxelArray< T >::UT_VoxelArray | ( | ) | [inline] |
Definition at line 1102 of file UT_VoxelArray.C.
| UT_VoxelArray< T >::~UT_VoxelArray | ( | ) | [inline, virtual] |
Definition at line 1120 of file UT_VoxelArray.C.
| UT_VoxelArray< T >::UT_VoxelArray | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
| void UT_VoxelArray< T >::clampIndex | ( | int & | x, | |
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Clamps the given x, y, and z values to lie inside the valid index range.
Definition at line 513 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::collapseAllTiles | ( | ) | [inline] |
This tries to compress or collapse each tile. This can be expensive (ie, converting a tile to constant), so should be saved until modifications are complete.
Definition at line 1813 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::constant | ( | T | t | ) | [inline] |
Sets this voxel array to the given constant value. All tiles are turned into constant tiles.
Definition at line 1279 of file UT_VoxelArray.C.
| T UT_VoxelArray< T >::evaluate | ( | const UT_Vector3 & | pos, | |
| const UT_Filter & | filter, | |||
| fpreal | radius | |||
| ) | const [inline] |
Filtered evaluation of the voxel array. This operation should exhibit the same behavior as IMG3D_Channel::evaluate. Borders evaluate to 0 and the border type is ignored. radius is measured in voxels.
Definition at line 1583 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::expandAllTiles | ( | ) | [inline] |
Uncompresses all tiles into non-constant tiles. Useful if you have a multithreaded algorithm that may need to both read and write, if you write to a collapsed tile while someone else reads from it, bad stuff happens. Instead, you can expandAllTiles. This may have serious consequences in memory use, however.
Definition at line 1826 of file UT_VoxelArray.C.
| UT_VoxelBorderType UT_VoxelArray< T >::getBorder | ( | ) | const [inline] |
Definition at line 598 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::getBorderValue | ( | ) | const [inline] |
Definition at line 599 of file UT_VoxelArray.h.
| fpreal UT_VoxelArray< T >::getCompressionTolerance | ( | ) | const [inline] |
Definition at line 641 of file UT_VoxelArray.h.
| UT_VoxelTile<T>* UT_VoxelArray< T >::getLinearTile | ( | int | idx | ) | const [inline] |
Definition at line 618 of file UT_VoxelArray.h.
| int64 UT_VoxelArray< T >::getMemoryUsage | ( | void | ) | const [inline] |
| int UT_VoxelArray< T >::getRes | ( | int | axis | ) | const [inline] |
Definition at line 460 of file UT_VoxelArray.h.
| UT_VoxelTile<T>* UT_VoxelArray< T >::getTile | ( | int | tx, | |
| int | ty, | |||
| int | tz | |||
| ) | const [inline] |
The direct tile access methods are to make TBF writing a bit more efficient.
Definition at line 616 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getTileRes | ( | int | dim | ) | const [inline] |
Number of tiles along that axis. Not to be confused with the resolution of the individual tiles.
Definition at line 635 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::getValue | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
This will clamp the bounds to fit within the voxel array, using the border type to resolve out of range values.
Definition at line 549 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getXRes | ( | ) | const [inline] |
Definition at line 457 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getYRes | ( | ) | const [inline] |
Definition at line 458 of file UT_VoxelArray.h.
| int UT_VoxelArray< T >::getZRes | ( | ) | const [inline] |
Definition at line 459 of file UT_VoxelArray.h.
| bool UT_VoxelArray< T >::indexToPos | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| UT_Vector3 & | pos | |||
| ) | const [inline] |
Converts an index into a position. Returns false if the source index was out of range, in which case pos will be outside [0..1]^3
Definition at line 1780 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::isConstant | ( | T * | cval = 0 |
) | const [inline] |
If this voxel array is all constant tiles, returns true. The optional pointer is initialized to the constant value iff the array is constant. (Note by constant we mean made of constant tiles of the same value - if some tiles are uncompressed but constant, it will still return false)
Definition at line 1292 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::isValidIndex | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
Returns true if the given x, y, z values lie inside the valid index.
Definition at line 521 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::linearTileToXYZ | ( | int | idx, | |
| int & | x, | |||
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Definition at line 620 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::loadData | ( | UT_IStream & | is | ) | [inline] |
Load an array, requires you have already size()d this array.
Definition at line 1873 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::match | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
This will ensure this voxel array matches the given voxel array in terms of dimensions & border conditions. It may invoke a size() and hence reset the field to 0.
Definition at line 1248 of file UT_VoxelArray.C.
| int UT_VoxelArray< T >::numTiles | ( | ) | const [inline] |
| int UT_VoxelArray< T >::numVoxels | ( | ) | const [inline] |
Definition at line 638 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::operator() | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
This allows you to read & write the raw data. Out of bound reads are illegal.
Definition at line 530 of file UT_VoxelArray.h.
| T UT_VoxelArray< T >::operator() | ( | UT_Vector3 | pos | ) | const [inline] |
This convience function lets you sample the voxel array. pos is in the range [0..1]^3. T value trilinearly interpolated. Edges are determined by the border mode. The cells are sampled at the center of the voxels.
Definition at line 1331 of file UT_VoxelArray.C.
| const UT_VoxelArray< T > & UT_VoxelArray< T >::operator= | ( | const UT_VoxelArray< T > & | src | ) | [inline] |
| bool UT_VoxelArray< T >::posToIndex | ( | UT_Vector3 | pos, | |
| UT_Vector3 & | ipos | |||
| ) | const [inline] |
Convertes a 3d position in [0..1]^3 into the equivalent in the integer cell space. Does not clamp to the closest value.
Definition at line 1753 of file UT_VoxelArray.C.
| bool UT_VoxelArray< T >::posToIndex | ( | UT_Vector3 | pos, | |
| int & | x, | |||
| int & | y, | |||
| int & | z | |||
| ) | const [inline] |
Converts a 3d position in range [0..1]^3 into the closest index value. Returns false if the resulting index was out of range. The index will still be set.
Definition at line 1732 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::resample | ( | const UT_VoxelArray< T > & | src, | |
| UT_FilterType | filtertype = UT_FILTER_POINT | |||
| ) | [inline] |
Fills this by resampling the given voxel array. Uses evaluate internally, so the same caveats apply regarding border behaviour.
Definition at line 1681 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::saveData | ( | ostream & | os | ) | [inline] |
Saves only the data of this array to the given stream. To reload it you will have to have a matching array in tiles dimensions and size. Not consta as unsupported compression engines will be uncompressed.
Definition at line 1839 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::setBorder | ( | UT_VoxelBorderType | type, | |
| T | t | |||
| ) | [inline] |
Definition at line 1805 of file UT_VoxelArray.C.
| void UT_VoxelArray< T >::setCompressionTolerance | ( | fpreal | tol | ) | [inline] |
Definition at line 643 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::setValue | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| T | t | |||
| ) | [inline] |
Definition at line 538 of file UT_VoxelArray.h.
| void UT_VoxelArray< T >::size | ( | int | xres, | |
| int | yres, | |||
| int | zres | |||
| ) | [inline] |
This sets the voxelarray to have the given resolution, resetting all elements to 0.
Definition at line 1190 of file UT_VoxelArray.C.
| int UT_VoxelArray< T >::xyzTileToLinear | ( | int | x, | |
| int | y, | |||
| int | z | |||
| ) | const [inline] |
Definition at line 630 of file UT_VoxelArray.h.
1.5.9