|
Field3D
|
Checks if all the absolute values in the SparseBlock are greater than some number. Useful for making narrow band levelsets Used by SparseField::releaseBlocks(). More...
#include <SparseField.h>
Public Member Functions | |
| bool | check (const SparseBlock< Data_T > &block, Data_T &retEmptyValue, const V3i &validSize, const V3i &blockSize) |
| Checks whether a given block can be released. It's safe to assume that the block is allocated if this functor is called. | |
| CheckMaxAbs (Data_T maxValue) | |
| Constructor. Takes max value. | |
Private Attributes | |
| Data_T | m_maxValue |
Checks if all the absolute values in the SparseBlock are greater than some number. Useful for making narrow band levelsets Used by SparseField::releaseBlocks().
Definition at line 558 of file SparseField.h.
| Sparse::CheckMaxAbs< Data_T >::CheckMaxAbs | ( | Data_T | maxValue | ) | [inline] |
Constructor. Takes max value.
Definition at line 561 of file SparseField.h.
: m_maxValue(maxValue) { }
| bool Sparse::CheckMaxAbs< Data_T >::check | ( | const SparseBlock< Data_T > & | block, |
| Data_T & | retEmptyValue, | ||
| const V3i & | validSize, | ||
| const V3i & | blockSize | ||
| ) | [inline] |
Checks whether a given block can be released. It's safe to assume that the block is allocated if this functor is called.
| block | Reference to the block to check |
| retEmptyValue | If the block is to be removed, store the "empty value" that replaces it in this variable |
| validSize | Number of voxels per dim within field data window |
| blockSize | Number of voxels actually allocated per dim |
Definition at line 572 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data, and Sparse::CheckMaxAbs< Data_T >::m_maxValue.
{
// Store first value
Data_T first = block.data[0];
// Iterate over rest
bool allGreater = true;
if (validSize == blockSize) {
// interior block so look at all voxels
for (typename std::vector<Data_T>::const_iterator i = block.data.begin();
i != block.data.end(); ++i) {
if (isAnyLess<Data_T>(*i, m_maxValue)) {
allGreater = false;
break;
}
}
} else {
// only look at valid voxels
int x=0, y=0, z=0;
for (typename std::vector<Data_T>::const_iterator i = block.data.begin();
i != block.data.end(); ++i, ++x) {
if (x >= blockSize.x) {
x = 0;
++y;
if (y >= blockSize.y) {
y = 0;
++z;
}
}
if (x >= validSize.x || y >= validSize.y || z >= validSize.z) {
continue;
}
if (isAnyLess<Data_T>(*i, m_maxValue)) {
allGreater = false;
break;
}
}
} // end of interior block test
if (allGreater) {
retEmptyValue = first;
return true;
} else {
return false;
}
}
Data_T Sparse::CheckMaxAbs< Data_T >::m_maxValue [private] |
Definition at line 619 of file SparseField.h.
Referenced by Sparse::CheckMaxAbs< Data_T >::check().