Template Class FastBox

Inheritance Relationships

Derived Types

Class Documentation

template<typename BaseVecT>
class FastBox

A volume representation used by the standard Marching Cubes implementation.

Subclassed by lvr2::BilinearFastBox< BaseVecT >, lvr2::SharpBox< BaseVecT >, lvr2::TetraederBox< BaseVecT >

Public Functions

FastBox(BaseVecT center)

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

inline virtual ~FastBox()

Destructor.NormalT.

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.

Parameters:
  • index – One of the eight cell corners.

  • value – An index in the reconstruction grid.

void setNeighbor(int index, FastBox<BaseVecT> *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.

uint getVertex(int index)

Gets the vertex index of the queried cell corner.

Parameters:

index – One of the eight cell corners

Returns:

A vertex index.

FastBox<BaseVecT> *getNeighbor(int index)
inline BaseVecT &getCenter()
inline const BaseVecT &getCenter() const
virtual void getSurface(BaseMesh<BaseVecT> &mesh, const std::vector<QueryPoint<BaseVecT>> &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.

virtual void getSurface(BaseMesh<BaseVecT> &mesh, const std::vector<QueryPoint<BaseVecT>> &query_points, uint &globalIndex, BoundingBox<BaseVecT> &bb, vector<unsigned int> &duplicates, float comparePrecision)

Public Members

OptionalVertexHandle m_intersections[12]

The twelve intersection between box and surface.

BaseVecT m_center

The box center.

FastBox<BaseVecT> *m_neighbors[27]

Pointer to all adjacent cells.

Public Static 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.

Protected Types

typedef FastBox<BaseVecT> BoxType

Protected Functions

inline bool compareFloat(double num1, double num2) const
int getIndex(const std::vector<QueryPoint<BaseVecT>> &query_points) const

Calculated the index for the MC table.

bool isInvalid(const std::vector<QueryPoint<BaseVecT>> &query_points) const

Returns if the box is valid or not.

void getIntersections(const BaseVecT *corners, float *distance, BaseVecT *positions) const

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.

void getCorners(BaseVecT corners[], const std::vector<QueryPoint<BaseVecT>> &query_points) const

Calculates the position of the eight cell corners.

Parameters:
  • corners – The cell corners

  • query_points – The query points of the grid

void getDistances(float distances[], const std::vector<QueryPoint<BaseVecT>> &query_points) const

Calculates the distance value for the eight cell corners.

Parameters:
  • distances – The distance values

  • query_points – The query points of the grid

float calcIntersection(float x1, float x2, float d1, float d2) const
float distanceToBB(const BaseVecT &v, const BoundingBox<BaseVecT> &bb) const

Protected Attributes

uint m_vertices[8]

The eight box corners.

Friends

friend class BilinearFastBox