Field3D
SparseField< Data_T >::block_iterator Class Reference

#include <SparseField.h>

Public Types

typedef SparseField< Data_T > class_type
 Convenience typedef. More...
 

Public Member Functions

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

Public Attributes

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

Private Member Functions

void recomputeBlockBoundingBox ()
 

Private Attributes

Box3i m_currentBlockWindow
 Bounding box in voxel coordinates for the current block. More...
 
const class_typem_field
 Pointer to field we're traversing. More...
 
Box3i m_window
 Bounding box for block indices. More...
 

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 940 of file SparseField.h.

Member Typedef Documentation

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

Convenience typedef.

Definition at line 944 of file SparseField.h.

Constructor & Destructor Documentation

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 946 of file SparseField.h.

948  : x(currentPos.x), y(currentPos.y), z(currentPos.z),
949  m_window(window), m_field(field)
950  {
952  }

Member Function Documentation

template<class Data_T>
const block_iterator& SparseField< Data_T >::block_iterator::operator++ ( )
inline

Increment iterator.

Definition at line 954 of file SparseField.h.

References SparseField< Data_T >::block_iterator::x.

955  {
956  if (x == m_window.max.x) {
957  if (y == m_window.max.y) {
958  x = m_window.min.x;
959  y = m_window.min.y;
960  ++z;
961  } else {
962  x = m_window.min.x;
963  ++y;
964  }
965  } else {
966  ++x;
967  }
969  return *this;
970  }
template<class Data_T>
bool SparseField< Data_T >::block_iterator::operator== ( const block_iterator rhs) const
inline

Equality check.

Definition at line 972 of file SparseField.h.

References SparseField< Data_T >::block_iterator::x, SparseField< Data_T >::block_iterator::y, and SparseField< Data_T >::block_iterator::z.

973  {
974  return x == rhs.x && y == rhs.y && z == rhs.z;
975  }
template<class Data_T>
bool SparseField< Data_T >::block_iterator::operator!= ( const block_iterator rhs) const
inline

Inequality check.

Definition at line 977 of file SparseField.h.

References SparseField< Data_T >::block_iterator::x, SparseField< Data_T >::block_iterator::y, and SparseField< Data_T >::block_iterator::z.

978  {
979  return x != rhs.x || y != rhs.y || z != rhs.z;
980  }
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 982 of file SparseField.h.

983  {
984  return m_currentBlockWindow;
985  }
template<class Data_T>
void SparseField< Data_T >::block_iterator::recomputeBlockBoundingBox ( )
inlineprivate

Definition at line 989 of file SparseField.h.

References SparseField< Data_T >::blockSize(), and FIELD3D_CLIP.

990  {
991  Box3i box;
992  int blockSize = m_field.blockSize();
993  box.min = V3i(x * blockSize, y * blockSize, z * blockSize);
994  box.max = box.min + V3i(blockSize - 1, blockSize - 1, blockSize - 1);
995  // Clamp the box
996  box.min = FIELD3D_CLIP(box.min, m_field.dataWindow());
997  box.max = FIELD3D_CLIP(box.max, m_field.dataWindow());
998  // Set the member variable
999  m_currentBlockWindow = box;
1000  }

Member Data Documentation

template<class Data_T>
int SparseField< Data_T >::block_iterator::x
template<class Data_T>
int SparseField< Data_T >::block_iterator::y
template<class Data_T>
int SparseField< Data_T >::block_iterator::z
template<class Data_T>
Box3i SparseField< Data_T >::block_iterator::m_window
private

Bounding box for block indices.

Definition at line 1002 of file SparseField.h.

template<class Data_T>
const class_type& SparseField< Data_T >::block_iterator::m_field
private

Pointer to field we're traversing.

Definition at line 1004 of file SparseField.h.

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 1006 of file SparseField.h.


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