Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

lssr::FastBox< VertexT, NormalT > Class Template Reference

A volume representation used by the standard Marching Cubes implementation. More...

#include <FastBox.hpp>

List of all members.

Public Member Functions

 FastBox (VertexT &center)
 Constructs a new box at the given center point defined by the used m_voxelsize}.
virtual ~FastBox ()
 Destructor.
void setVertex (int index, uint value)
 Each cell vertex (0 to 7) as associated with a vertex in the reconstruction grid. This methods assigns the index value} to the index}th cell corner.
void setNeighbor (int index, FastBox< VertexT, NormalT > *cell)
 Adjacent cells in the grid should use common vertices. This functions assigns the value of corner[index] to the corresponding corner of the give neighbor cell.
uint getVertex (int index)
 Gets the vertex index of the queried cell corner.
FastBox< VertexT, NormalT > * getNeighbor (int index)
void getSurface (BaseMesh< VertexT, NormalT > &mesh, vector< QueryPoint< VertexT > > &query_points, uint &globalIndex)
 Performs a local reconstruction according to the standard Marching Cubes table from Paul Bourke.

Static Public Attributes

static float m_voxelsize
 The voxelsize of the reconstruction grid.
static uint INVALID_INDEX
 An index value that is used to reference vertices that are not in the grid.

Private Member Functions

float calcIntersection (float x1, float x2, float d1, float d2)
int getIndex (vector< QueryPoint< VertexT > > &query_points)
 Calculated the index for the MC table.
void getCorners (VertexT corners[], vector< QueryPoint< VertexT > > &query_points)
 Calculates the position of the eight cell corners.
void getDistances (float distances[], vector< QueryPoint< VertexT > > &query_points)
 Calculates the distance value for the eight cell corners.
void getIntersections (VertexT corners[], float distance[], VertexT positions[])
 Calculated the 12 possible intersections between the cell and the surface to interpolate.

Private Attributes

VertexT m_center
 The box center.
uint m_vertices [8]
 The eight box corners.
uint m_intersections [12]
 The twelve intersection between box and surface.
FastBox< VertexT, NormalT > * m_neighbors [27]
 Pointer to all adjacent cells.

Detailed Description

template<typename VertexT, typename NormalT>
class lssr::FastBox< VertexT, NormalT >

A volume representation used by the standard Marching Cubes implementation.

Definition at line 30 of file FastBox.hpp.


Constructor & Destructor Documentation

template<typename VertexT, typename NormalT>
lssr::FastBox< VertexT, NormalT >::FastBox ( VertexT &  center  ) 

Constructs a new box at the given center point defined by the used m_voxelsize}.

template<typename VertexT, typename NormalT>
virtual lssr::FastBox< VertexT, NormalT >::~FastBox (  )  [inline, virtual]

Destructor.

Definition at line 43 of file FastBox.hpp.


Member Function Documentation

template<typename VertexT, typename NormalT>
float lssr::FastBox< VertexT, NormalT >::calcIntersection ( float  x1,
float  x2,
float  d1,
float  d2 
) [private]
template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::getCorners ( VertexT  corners[],
vector< QueryPoint< VertexT > > &  query_points 
) [private]

Calculates the position of the eight cell corners.

Parameters:
corners The cell corners
query_points The query points of the grid
template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::getDistances ( float  distances[],
vector< QueryPoint< VertexT > > &  query_points 
) [private]

Calculates the distance value for the eight cell corners.

Parameters:
distances The distance values
query_points The query points of the grid
template<typename VertexT, typename NormalT>
int lssr::FastBox< VertexT, NormalT >::getIndex ( vector< QueryPoint< VertexT > > &  query_points  )  [private]

Calculated the index for the MC table.

template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::getIntersections ( VertexT  corners[],
float  distance[],
VertexT  positions[] 
) [private]

Calculated the 12 possible intersections between the cell and the surface to interpolate.

Parameters:
corners The eight corners of the current cell
distance The corresponding distance value
positions The interpolated intersections.
template<typename VertexT, typename NormalT>
FastBox<VertexT, NormalT>* lssr::FastBox< VertexT, NormalT >::getNeighbor ( int  index  ) 
template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::getSurface ( BaseMesh< VertexT, NormalT > &  mesh,
vector< QueryPoint< VertexT > > &  query_points,
uint &  globalIndex 
)

Performs a local reconstruction according to the standard Marching Cubes table from Paul Bourke.

Parameters:
mesh The reconstructed mesh
query_points A vector containing the query points of the reconstruction grid
globalIndex The index of the newest vertex in the mesh, i.e. a newly generated vertex shout have the index globalIndex + 1.
template<typename VertexT, typename NormalT>
uint lssr::FastBox< VertexT, NormalT >::getVertex ( int  index  ) 

Gets the vertex index of the queried cell corner.

Parameters:
index One of the eight cell corners
Returns:
A vertex index.
template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::setNeighbor ( int  index,
FastBox< VertexT, NormalT > *  cell 
)

Adjacent cells in the grid should use common vertices. This functions assigns the value of corner[index] to the corresponding corner of the give neighbor cell.

Parameters:
index One of the eight cell corners.
cell A neighbor cell.
template<typename VertexT, typename NormalT>
void lssr::FastBox< VertexT, NormalT >::setVertex ( int  index,
uint  value 
)

Each cell vertex (0 to 7) as associated with a vertex in the reconstruction grid. This methods assigns the index value} to the index}th cell corner.

Parameters:
index One of the eight cell corners.
value An index in the reconstruction grid.

Member Data Documentation

template<typename VertexT, typename NormalT>
uint lssr::FastBox< VertexT, NormalT >::INVALID_INDEX [static]

An index value that is used to reference vertices that are not in the grid.

Definition at line 93 of file FastBox.hpp.

template<typename VertexT, typename NormalT>
VertexT lssr::FastBox< VertexT, NormalT >::m_center [private]

The box center.

Definition at line 139 of file FastBox.hpp.

template<typename VertexT, typename NormalT>
uint lssr::FastBox< VertexT, NormalT >::m_intersections[12] [private]

The twelve intersection between box and surface.

Definition at line 145 of file FastBox.hpp.

template<typename VertexT, typename NormalT>
FastBox<VertexT, NormalT>* lssr::FastBox< VertexT, NormalT >::m_neighbors[27] [private]

Pointer to all adjacent cells.

Definition at line 148 of file FastBox.hpp.

template<typename VertexT, typename NormalT>
uint lssr::FastBox< VertexT, NormalT >::m_vertices[8] [private]

The eight box corners.

Definition at line 142 of file FastBox.hpp.

template<typename VertexT, typename NormalT>
float lssr::FastBox< VertexT, NormalT >::m_voxelsize [static]

The voxelsize of the reconstruction grid.

Definition at line 90 of file FastBox.hpp.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Defines