Program Listing for File DMCReconstruction.hpp
↰ Return to documentation for file (include/lvr2/reconstruction/DMCReconstruction.hpp)
/*
* DMCReconstruction.hpp
*
* Created on: 18.01.2019
* Author: Benedikt Schumacher
*/
#ifndef DMCReconstruction_HPP_
#define DMCReconstruction_HPP_
#include "lvr2/geometry/BaseVector.hpp"
#include "lvr2/geometry/BoundingBox.hpp"
#include "lvr2/reconstruction/PointsetMeshGenerator.hpp"
#include "lvr2/reconstruction/LocalApproximation.hpp"
#include "lvr2/reconstruction/PointsetSurface.hpp"
#include "lvr2/reconstruction/MCTable.hpp"
#include "lvr2/util/Progress.hpp"
#include "DMCVecPointHandle.hpp"
#include "metrics/MSRMetric.hpp"
#include "metrics/DMCReconstructionMetric.hpp"
#include "Octree.hpp"
#include "DualOctree.hpp"
#include "Location.hh"
#include "lvr2/reconstruction/FastReconstruction.hpp"
namespace lvr2
{
struct my_dummy
{
Location location;
int next = -1;
};
template<typename BaseVecT, typename BoxT>
class DMCReconstruction : public FastReconstructionBase<BaseVecT>, public PointsetMeshGenerator<BaseVecT>
{
public:
DMCReconstruction(
PointsetSurfacePtr<BaseVecT> surface,
BoundingBox<BaseVecT> bb,
bool dual,
int maxLevel,
float maxError);
virtual ~DMCReconstruction();
virtual void getMesh(BaseMesh<BaseVecT> &mesh);
virtual void getMesh(BaseMesh<BaseVecT> &flatMesh, BaseMesh<BaseVecT> &deepMesh, int delta);
virtual void getMesh(
BaseMesh<BaseVecT>& mesh,
BoundingBox<BaseVecT>& bb,
vector<unsigned int>& duplicates,
float comparePrecision
);
protected:
DualLeaf<BaseVecT, BoxT>* getDualLeaf(
CellHandle &cell,
int cells,
C_Octree<BaseVecT, BoxT, my_dummy> &octree,
char pos);
void buildTree(
C_Octree<BaseVecT, BoxT, my_dummy> &parent,
int levels,
bool dual,
DMCReconstructionMetric<BaseVecT, BoxT> *reconstructionMetric,
int deltas);
void traverseTree(BaseMesh<BaseVecT> &mesh,
C_Octree<BaseVecT, BoxT, my_dummy> &octree);
void detectVertexForDualCell(
C_Octree<BaseVecT, BoxT, my_dummy> &octree,
CellHandle ch,
int cells,
float max_bb_width,
uint pos,
int onEdge,
BaseVecT &feature);
void getRotationMatrix(
float matrix[9],
BaseVecT v1,
BaseVecT v2,
BaseVecT v3);
float getDistance(BaseVecT p,
BaseVecT v1,
BaseVecT v2,
BaseVecT v3);
float getDistance(BaseVecT p,
BaseVecT v1,
BaseVecT v2);
float getDistance(BaseVecT v1,
BaseVecT v2);
float edgeEquation(BaseVecT p,
BaseVecT v1,
BaseVecT v2);
void matrixDotVector(float* matrix,
BaseVecT* vector);
void getSurface(BaseMesh<BaseVecT> &mesh,
DualLeaf<BaseVecT, BoxT> *leaf,
int cells,
short level);
void drawOctree(C_Octree<BaseVecT, BoxT, my_dummy> &parent);
// Indicator whether the point fitting shoulb be done on dual cells
bool m_dual;
// The maximum allowed level for the octree
int m_maxLevel;
// The max allowed arror between points and surfaces
float m_maxError;
// Sizes of Boundig Box
BaseVecT bb_min;
BaseVecT bb_max;
float bb_size[3];
float bb_longestSide;
// Center of the bounding box.
BaseVecT m_boundingBoxCenter;
// Count of the octree leaves.
uint m_leaves;
// Global progress bar.
ProgressBar *m_progressBar;
// Pointer to the new Octree
C_Octree<BaseVecT, BoxT, my_dummy> *octree;
// Pointer to the deeper Octree
C_Octree<BaseVecT, BoxT, my_dummy> *deepOctree;
// PointHandler
unique_ptr<DMCPointHandle<BaseVecT>> m_pointHandler;
// just for visualization
std::vector< BaseVecT > dualVertices;
};
} // namespace lvr2
#include "DMCReconstruction.tcc"
#endif /* DMCReconstruction_HPP_ */