SparseField< Data_T >::block_iterator Class Reference

`#include <SparseField.h>`

## Public Types

typedef SparseField< Data_T > | class_type
| Convenience typedef.

## Public Member Functions

| block_iterator (const class_type &field, const Box3i &window, const V3i &currentPos)
| Constructor.
const Box3i & | blockBoundingBox ()
| Returns a reference to the bounding box representing the current block.
bool | operator!= (const block_iterator &rhs) const
| Inequality check.
const block_iterator & | operator++ ()
| Increment iterator.
bool | operator== (const block_iterator &rhs) const
| Equality check.

## Public Attributes

int | x
| Current block index.
int | y
int | z

## Private Member Functions

void | recomputeBlockBoundingBox ()

## Private Attributes

Box3i | m_currentBlockWindow
| Bounding box in voxel coordinates for the current block.
const class_type & | m_field
| Pointer to field we're traversing.
Box3i | m_window
| Bounding box for block indices.

## Detailed Description

template<class Data_T>
class SparseField< Data_T >::block_iterator

Note
  This iterator type can not be dereferenced. It's only used to provide a bounding box and indices for each block.

Definition at line 1213 of file SparseField.h.

## Member Typedef Documentation

## class_type

template<class Data_T>

typedef SparseField<Data_T> SparseField< Data_T >::block_iterator::class_type

Convenience typedef.

Definition at line 1217 of file SparseField.h.

## Constructor & Destructor Documentation

## block_iterator()

template<class Data_T>

SparseField< Data_T >::block_iterator::block_iterator | ( | const class_type & | field,
|  | const Box3i & | window,
|  | const V3i & | currentPos )

inline

Constructor.

Definition at line 1219 of file SparseField.h.

: x(currentPos.x), y(currentPos.y), z(currentPos.z),
m_window(window), m_field(field)
{
recomputeBlockBoundingBox();
}
SparseField::block_iterator::m_field
const class_type & m_field
Pointer to field we're traversing.
Definition SparseField.h:1277
SparseField::block_iterator::m_window
Box3i m_window
Bounding box for block indices.
Definition SparseField.h:1275
SparseField::block_iterator::x
int x
Current block index.
Definition SparseField.h:1260
SparseField::block_iterator::recomputeBlockBoundingBox
void recomputeBlockBoundingBox()
Definition SparseField.h:1262
SparseField::block_iterator::y
int y
Definition SparseField.h:1260
SparseField::block_iterator::z
int z
Definition SparseField.h:1260
SparseField
This Field subclass stores voxel data in block-allocated arrays.
Definition SparseField.h:352

References m_field, m_window, recomputeBlockBoundingBox(), x, y, and z.

Referenced by operator!=(), operator++(), and operator==().

## Member Function Documentation

## operator++()

template<class Data_T>

const block_iterator & SparseField< Data_T >::block_iterator::operator++ | ( |  | ) |

inline

Increment iterator.

Definition at line 1227 of file SparseField.h.

{
if (x == m_window.max.x) {
if (y == m_window.max.y) {
x = m_window.min.x;
y = m_window.min.y;
++z;
} else {
x = m_window.min.x;
++y;
}
} else {
++x;
}
recomputeBlockBoundingBox();
return *this;
}

References block_iterator(), m_window, recomputeBlockBoundingBox(), x, y, and z.

## operator==()

template<class Data_T>

bool SparseField< Data_T >::block_iterator::operator== | ( | const block_iterator & | rhs | ) | const

inline

Equality check.

Definition at line 1245 of file SparseField.h.

{
return x == rhs.x && y == rhs.y && z == rhs.z;
}

References block_iterator(), x, y, and z.

## operator!=()

template<class Data_T>

bool SparseField< Data_T >::block_iterator::operator!= | ( | const block_iterator & | rhs | ) | const

inline

Inequality check.

Definition at line 1250 of file SparseField.h.

{
return x != rhs.x || y != rhs.y || z != rhs.z;
}

References block_iterator(), x, y, and z.

## blockBoundingBox()

template<class Data_T>

const Box3i & SparseField< Data_T >::block_iterator::blockBoundingBox | ( |  | ) |

inline

Returns a reference to the bounding box representing the current block.

Definition at line 1255 of file SparseField.h.

{
return m_currentBlockWindow;
}
SparseField::block_iterator::m_currentBlockWindow
Box3i m_currentBlockWindow
Bounding box in voxel coordinates for the current block.
Definition SparseField.h:1279

References m_currentBlockWindow.

## recomputeBlockBoundingBox()

template<class Data_T>

void SparseField< Data_T >::block_iterator::recomputeBlockBoundingBox | ( |  | ) |

inline private

Definition at line 1262 of file SparseField.h.

{
Box3i box;
int blockSize = m_field.blockSize();
box.min = V3i(x * blockSize, y * blockSize, z * blockSize);
box.max = box.min + V3i(blockSize - 1, blockSize - 1, blockSize - 1);
// Clamp the box
box.min = FIELD3D_CLIP(box.min, m_field.dataWindow());
box.max = FIELD3D_CLIP(box.max, m_field.dataWindow());
// Set the member variable
m_currentBlockWindow = box;
}
V3i
Imath::V3i V3i
Definition SpiMathLib.h:71
FIELD3D_CLIP
#define FIELD3D_CLIP
Definition SpiMathLib.h:90

References SparseField< Data_T >::blockSize(), FIELD3D_CLIP, m_currentBlockWindow, m_field, x, y, and z.

Referenced by block_iterator(), and operator++().

## Member Data Documentation

## x

template<class Data_T>

int SparseField< Data_T >::block_iterator::x

Current block index.

Definition at line 1260 of file SparseField.h.

Referenced by block_iterator(), operator!=(), operator++(), operator==(), and recomputeBlockBoundingBox().

## y

template<class Data_T>

int SparseField< Data_T >::block_iterator::y

Definition at line 1260 of file SparseField.h.

Referenced by block_iterator(), operator!=(), operator++(), operator==(), and recomputeBlockBoundingBox().

## z

template<class Data_T>

int SparseField< Data_T >::block_iterator::z

Definition at line 1260 of file SparseField.h.

Referenced by block_iterator(), operator!=(), operator++(), operator==(), and recomputeBlockBoundingBox().

## m_window

template<class Data_T>

Box3i SparseField< Data_T >::block_iterator::m_window

private

Bounding box for block indices.

Definition at line 1275 of file SparseField.h.

Referenced by block_iterator(), and operator++().

## m_field

template<class Data_T>

const class_type& SparseField< Data_T >::block_iterator::m_field

private

Pointer to field we're traversing.

Definition at line 1277 of file SparseField.h.

Referenced by block_iterator(), and recomputeBlockBoundingBox().

## m_currentBlockWindow

template<class Data_T>

Box3i SparseField< Data_T >::block_iterator::m_currentBlockWindow

private

Bounding box in voxel coordinates for the current block.

Definition at line 1279 of file SparseField.h.

Referenced by blockBoundingBox(), and recomputeBlockBoundingBox().

The documentation for this class was generated from the following file:

- export/SparseField.h