Template Class DMCReconstruction

Inheritance Relationships

Base Types

Class Documentation

template<typename BaseVecT, typename BoxT>
class DMCReconstruction : public lvr2::FastReconstructionBase<BaseVecT>, public lvr2::PointsetMeshGenerator<BaseVecT>

A surface reconstruction object that implements the standard marching cubes algorithm using a octree and a thread pool for parallel computation.

Public Functions

DMCReconstruction(PointsetSurfacePtr<BaseVecT> surface, BoundingBox<BaseVecT> bb, bool dual, int maxLevel, float maxError)

Constructor.

Parameters:
  • surface – Pointer to the surface

  • bbBoundingBox of the PointCloud

  • dual

  • maxLevel – Max allowed octree level

  • maxError – Max allowed error between points and surfaces

virtual ~DMCReconstruction()

Destructor.

virtual void getMesh(BaseMesh<BaseVecT> &mesh)

Returns the surface reconstruction of the given point set.

Parameters:

mesh

virtual void getMesh(BaseMesh<BaseVecT> &flatMesh, BaseMesh<BaseVecT> &deepMesh, int delta)

Returns the surface reconstruction of the given point set plus a (+depth) deeper version.

Parameters:
  • flatMesh – the flat mesh starting point

  • deepMesh – the mesh that is delta levels deeper

virtual void getMesh(BaseMesh<BaseVecT> &mesh, BoundingBox<BaseVecT> &bb, vector<unsigned int> &duplicates, float comparePrecision)

This is deprecated and has to stay in here for historic reasons.

Protected Functions

DualLeaf<BaseVecT, BoxT> *getDualLeaf(CellHandle &cell, int cells, C_Octree<BaseVecT, BoxT, my_dummy> &octree, char pos)

Builds a dual cell at given position.

Parameters:
  • cellCell of the regual octree

  • cells – number of cells at the cells octree level

  • octree – Reference to the octree

  • pos – Position of the specific dual cell

void buildTree(C_Octree<BaseVecT, BoxT, my_dummy> &parent, int levels, bool dual, DMCReconstructionMetric<BaseVecT, BoxT> *reconstructionMetric, int deltas)

Builds a tree level respectively creates the child nodes of a root node.

Parameters:
  • parentPoints – Points inside the parent node.

  • parent – Reference to the parent node.

  • childCenter – Centers of the children.

  • size – Actually voxelsize.

  • parentCenter – Center of the parent node.

  • reconstructionMetric – the metric that will be used for in place comparison of reconstruction vs pointcloud

  • delta – difference between flat and deep octree

void traverseTree(BaseMesh<BaseVecT> &mesh, C_Octree<BaseVecT, BoxT, my_dummy> &octree)

Traverses the octree and insert for each leaf the getSurface-function into the thread pool.

Parameters:
  • mesh – The reconstructed mesh.

  • node – Actually node.

void detectVertexForDualCell(C_Octree<BaseVecT, BoxT, my_dummy> &octree, CellHandle ch, int cells, float max_bb_width, uint pos, int onEdge, BaseVecT &feature)

Calculates the position of a aspecific point in a dual cell.

Parameters:
  • octree – The current octree instace

  • ch – The current cellHandle of the octree

  • cells – Number of possible cells at current level

  • max_bb_width – Width of the bounding box

  • pos – Position of the dual cell relative to the given cell

  • onEdge – Indicator whether the wished position lies on an edge

  • feature – Vector that should be filles with the correct position

void getRotationMatrix(float matrix[9], BaseVecT v1, BaseVecT v2, BaseVecT v3)

Calculates a rotation matrix for a triangle that rotates it into xy.

Parameters:
  • matrix – Array the matrix should be written in

  • v1 – First point of the triangle

  • v2 – Second point of the triangle

  • v3 – Third point of the triangle

float getDistance(BaseVecT p, BaseVecT v1, BaseVecT v2, BaseVecT v3)

Calculates the distance between a point and a triangle.

Parameters:
  • p – Vertex to calculate distance for

  • v1 – First point of the triangle

  • v2 – Second point of the triangle

  • v3 – Third point of the triangle

float getDistance(BaseVecT p, BaseVecT v1, BaseVecT v2)

Calculates the distance between a point and a line.

Parameters:
  • p – Vertex to calculate distance for

  • v1 – First point of the line

  • v2 – Second point of the line

float getDistance(BaseVecT v1, BaseVecT v2)

Calculates the distance between to points.

Parameters:
  • p – Vertex to calculate distance for

  • v1 – Point

float edgeEquation(BaseVecT p, BaseVecT v1, BaseVecT v2)

Calculates whether the given vertex lies left, right or on the given line.

Parameters:
  • p – Vertex to check position for

  • v1 – First point of the line

  • v2 – Second point of the line

void matrixDotVector(float *matrix, BaseVecT *vector)

Performs a matrix multiplication.

Parameters:
  • matrix – Pointer to the matrix

  • vector – Pointer to th vector

void getSurface(BaseMesh<BaseVecT> &mesh, DualLeaf<BaseVecT, BoxT> *leaf, int cells, short level)

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

Parameters:
  • mesh – The reconstructed mesh

  • leaf – A octree leaf.

  • cells

void drawOctree(C_Octree<BaseVecT, BoxT, my_dummy> &parent)

Saves the octree as wireframe. WORKS ONLY SINGLE THREADED!

Parameters:

parent – The octree

Protected Attributes

bool m_dual
int m_maxLevel
float m_maxError
BaseVecT bb_min
BaseVecT bb_max
float bb_size[3]
float bb_longestSide
BaseVecT m_boundingBoxCenter
uint m_leaves
ProgressBar *m_progressBar
C_Octree<BaseVecT, BoxT, my_dummy> *octree
C_Octree<BaseVecT, BoxT, my_dummy> *deepOctree
unique_ptr<DMCPointHandle<BaseVecT>> m_pointHandler
std::vector<BaseVecT> dualVertices