Field3D
SparseField::block_iterator Class Reference

#include <SparseField.h>

List of all members.

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 Box3iblockBoundingBox ()
 Returns a reference to the bounding box representing the current block.
bool operator!= (const block_iterator &rhs) const
 Inequality check.
const block_iteratoroperator++ ()
 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_typem_field
 Pointer to field we're traversing.
Box3i m_window
 Bounding box for block indices.

Detailed Description

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

Member Typedef Documentation

Convenience typedef.

Definition at line 944 of file SparseField.h.


Constructor & Destructor Documentation

SparseField::block_iterator::block_iterator ( const class_type field,
const Box3i window,
const V3i currentPos 
) [inline]

Constructor.

Definition at line 946 of file SparseField.h.

    : x(currentPos.x), y(currentPos.y), z(currentPos.z), 
      m_window(window), m_field(field)
  {
    recomputeBlockBoundingBox();
  }

Member Function Documentation

const block_iterator& SparseField::block_iterator::operator++ ( ) [inline]

Increment iterator.

Definition at line 954 of file SparseField.h.

References x.

  {
    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;
  }
bool SparseField::block_iterator::operator== ( const block_iterator rhs) const [inline]

Equality check.

Definition at line 972 of file SparseField.h.

References x, y, and z.

  {
    return x == rhs.x && y == rhs.y && z == rhs.z;
  }
bool SparseField::block_iterator::operator!= ( const block_iterator rhs) const [inline]

Inequality check.

Definition at line 977 of file SparseField.h.

References x, y, and z.

  {
    return x != rhs.x || y != rhs.y || z != rhs.z;
  }
const Box3i& SparseField::block_iterator::blockBoundingBox ( ) [inline]

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

Definition at line 982 of file SparseField.h.

  {
    return m_currentBlockWindow;
  }
void SparseField::block_iterator::recomputeBlockBoundingBox ( ) [inline, private]

Definition at line 989 of file SparseField.h.

References SparseField::blockSize(), and FIELD3D_CLIP.

  {
    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;
  }

Member Data Documentation

Current block index.

Definition at line 987 of file SparseField.h.

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

Definition at line 987 of file SparseField.h.

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

Definition at line 987 of file SparseField.h.

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

Bounding box for block indices.

Definition at line 1002 of file SparseField.h.

Pointer to field we're traversing.

Definition at line 1004 of file SparseField.h.

Bounding box in voxel coordinates for the current block.

Definition at line 1006 of file SparseField.h.


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