Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
exposing some SparseField utility functions in the public interface (…
Browse files Browse the repository at this point in the history
…issue #12)

git-svn-id: http://field3d.googlecode.com/svn/trunk@41 49ab6734-77db-11de-8970-65f630d19fb8
  • Loading branch information
callen128 committed Dec 3, 2009
1 parent 0a7f780 commit 2739e09
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions export/SparseField.h
Expand Up @@ -211,6 +211,27 @@ class SparseField
template <typename Functor_T>
int releaseBlocks(Functor_T func);

//! Calculates the block number based on a block i,j,k index
int blockId(int blockI, int blockJ, int blockK) const;

//! Calculates the block coordinates that a given set of voxel coords are in
//! \note The i,j,k coordinates are strictly positive, and refer to the
//! coordinates of a voxel -after- the data window offset has been applied.
void getBlockCoord(int i, int j, int k, int &bi, int &bj, int &bk) const;

//! Calculates the coordinates in a block for the given voxel index
//! \note The i,j,k coordinates are strictly positive, and refer to the
//! coordinates of a voxel -after- the data window offset has been applied.
void getVoxelInBlock(int i, int j, int k, int &vi, int &vj, int &vk) const;

//! Applies data window offset
void applyDataWindowOffset(int &i, int &j, int &k) const
{
i -= base::m_dataWindow.min.x;
j -= base::m_dataWindow.min.y;
k -= base::m_dataWindow.min.z;
}

// From Field base class -----------------------------------------------------

//! \name From Field
Expand Down Expand Up @@ -320,30 +341,9 @@ class SparseField
//! Initializes the block structure. Will clear any existing data
void setupBlocks();

//! Calculates the block number based on a block i,j,k index
int blockId(int blockI, int blockJ, int blockK) const;

//! Calculates the block coordinates that a given set of voxel coords are in
//! \note The i,j,k coordinates are strictly positive, and refer to the
//! coordinates of a voxel -after- the data window offset has been applied.
void getBlockCoord(int i, int j, int k, int &bi, int &bj, int &bk) const;

//! Calculates the coordinates in a block for the given voxel index
//! \note The i,j,k coordinates are strictly positive, and refer to the
//! coordinates of a voxel -after- the data window offset has been applied.
void getVoxelInBlock(int i, int j, int k, int &vi, int &vj, int &vk) const;

//! Deallocated the data of the given block and sets its empty value
void deallocBlock(Block &block, const Data_T &emptyValue);

//! Applies data window offset
void applyDataWindowOffset(int &i, int &j, int &k) const
{
i -= base::m_dataWindow.min.x;
j -= base::m_dataWindow.min.y;
k -= base::m_dataWindow.min.z;
}

//! \}

// Data members --------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion export/ns.h
Expand Up @@ -37,7 +37,7 @@

#define FIELD3D_MAJOR_VER 1
#define FIELD3D_MINOR_VER 1
#define FIELD3D_MICRO_VER 3
#define FIELD3D_MICRO_VER 4

#define FIELD3D_VERSION_NS v1_1

Expand Down

0 comments on commit 2739e09

Please sign in to comment.