Program Listing for File SharpBox.hpp

Return to documentation for file (include/lvr2/reconstruction/SharpBox.hpp)

#ifndef SHARPBOX_H_
#define SHARPBOX_H_

#include <float.h>

#include "FastBox.hpp"
#include "MCTable.hpp"
#include "ExtendedMCTable.hpp"
#include "PointsetSurface.hpp"

namespace lvr2
{

template<typename BaseVecT>
class SharpBox : public FastBox<BaseVecT>
{
public:
    SharpBox(BaseVecT center);
    virtual ~SharpBox();

    virtual void getSurface(
            BaseMesh<BaseVecT> &mesh,
            vector<QueryPoint<BaseVecT> > &query_points,
            uint &globalIndex);

    virtual void getSurface(
            std::vector<float>& vBuffer,
            std::vector<unsigned int>& fBuffer,
            vector<QueryPoint<BaseVecT> > &query_points,
            uint &globalIndex){}

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

    // Threshold angle for sharp feature detection
    static float m_theta_sharp;

    // Threshold angle for corner detection
    static float m_phi_corner;

    // Indicates if the Box contains a Sharp Feature
    // used for Edge Flipping
    bool m_containsSharpFeature;

    // Indicates if the Box contains a Sharp Corner
    // used for Edge Flipping
    bool m_containsSharpCorner;

    // The surface index of the Extended MC-Table
    // used for Edge Flipping
    uint m_extendedMCIndex;

    // the point set surface
    static PointsetSurfacePtr<BaseVecT> m_surface;

private:
    void getNormals(BaseVecT vertex_positions[],
                    Normal<typename BaseVecT::CoordType> vertex_normals[]);

    void detectSharpFeatures(BaseVecT vertex_positions[],
                             Normal<typename BaseVecT::CoordType> vertex_normals[], uint index);


    typedef SharpBox<BaseVecT> BoxType;
};

template<typename BaseVecT>
struct BoxTraits<SharpBox<BaseVecT> >
{
    static const string type;
};


} /* namespace lvr */

#include "SharpBox.tcc"

#endif /* SHARPBOX_H_ */