Commit 3feec578 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

comments of approximators and selectors

parent cb2b0201
......@@ -43,26 +43,30 @@ enum ApproximatorType
{
// One approx per edge
// Geometry approximators
A_QEM = 0,
A_MidEdge = 1,
A_QEM = 0, /**< Approximates the geometry of an edge collapse by quadric error metric minimization [GH97]. */
A_MidEdge = 1, /**< Approximates the geometry of an edge collapse by placing the resulting vertex in its middle. */
A_CornerCutting = 2,
A_TangentPredict1 = 3,
A_TangentPredict2 = 4,
A_NormalArea = 5,
A_NormalArea = 5, /**< EXPERIMENTAL Approximates the geometry of an edge collapse by minimization of its normal times area measure [Sauvage] */
// Geometry + color approximators
A_ColorNaive = 6,
A_ColorQEMext = 7,
A_GeomColorOpt = 8,
A_ColorNaive = 6, /**< Approximates the color of the resulting vertex by linear interpolation (based on the approximated position) of its two predecessors. */
A_ColorQEMext = 7, /**< Approximates both geometry and color of the resulting vertex by minimization of the extended (R^6) quadric error metric [GH98]. */
A_GeomColorOpt = 8, /**< EXPERIMENTAL. */
// One approx per half-edge
// Generic (considers all provided attributes) approximator
A_hHalfCollapse = 9,
A_hHalfCollapse = 9, /**< Approximates all provided attributes of a half-edge collapse by keeping the attributes of the first of two vertices. */
// Geometry approximator
A_hQEM = 10,
A_hQEM = 10, /**< Approximates the geometry of a full-edge collapse by quadric error metric minimization [GH97]. Compatible version for half-edge selectors. */
A_OTHER // for extensions use this type
A_OTHER /**< Can be used for extensions. */
} ;
/*!
* \class ApproximatorGen
* \brief Generic class holder for approximators
*/
template <typename PFP>
class ApproximatorGen
{
......@@ -92,6 +96,10 @@ public:
} ;
/*!
* \class Approximator
* \brief Generic class for approximators
*/
template <typename PFP, typename T, unsigned int ORBIT>
class Approximator : public ApproximatorGen<PFP>
{
......
......@@ -43,7 +43,8 @@ namespace Decimation
{
/**
* Decimate the mesh through edge contraction
* \fn decimate
* Function that decimates the provided mesh through successive edge collapses
* by using a declared selector and approximator type (see \file approximator.h and \file selector.h).
*
* \param map the map to decimate
......@@ -69,7 +70,8 @@ int decimate(
) ;
/**
* Decimate the mesh through edge contraction
*\fn decimate
* Function that decimates the provided mesh through successive edge collapses
* by providing the selector and the approximators
*
* \param map the map to decimate
......@@ -86,7 +88,7 @@ int decimate(
template <typename PFP>
int decimate(
typename PFP::MAP& map,
EdgeSelector<PFP>* s,
Selector<PFP>* s,
std::vector<ApproximatorGen<PFP>*>& a,
unsigned int nbWantedVertices,
bool recomputePriorityList = true,
......
......@@ -47,7 +47,7 @@ int decimate(
VertexAttribute<typename PFP::VEC3> position = *(attribs[0]) ;
std::vector<ApproximatorGen<PFP>*> approximators ;
EdgeSelector<PFP>* selector = NULL ;
Selector<PFP>* selector = NULL ;
std::vector<VertexAttribute<typename PFP::VEC3>* > *v_approx = NULL ;
......@@ -172,7 +172,7 @@ int decimate(
template <typename PFP>
int decimate(
typename PFP::MAP& map,
EdgeSelector<PFP>* selector, std::vector<ApproximatorGen<PFP>*>& approximators,
Selector<PFP>* selector, std::vector<ApproximatorGen<PFP>*>& approximators,
unsigned int nbWantedVertices,
bool recomputePriorityList,
EdgeAttribute<typename PFP::REAL> *edgeErrors,
......
......@@ -47,7 +47,7 @@ namespace Decimation
{
template <typename PFP>
class EdgeSelector_MapOrder : public EdgeSelector<PFP>
class EdgeSelector_MapOrder : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -59,7 +59,7 @@ private:
public:
EdgeSelector_MapOrder(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx)
Selector<PFP>(m, pos, approx)
{}
~EdgeSelector_MapOrder()
{}
......@@ -75,7 +75,7 @@ public:
} ;
template <typename PFP>
class EdgeSelector_Random : public EdgeSelector<PFP>
class EdgeSelector_Random : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -89,7 +89,7 @@ private:
public:
EdgeSelector_Random(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
cur(0),
allSkipped(false)
{}
......@@ -106,7 +106,7 @@ public:
} ;
template <typename PFP>
class EdgeSelector_Length : public EdgeSelector<PFP>
class EdgeSelector_Length : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -133,7 +133,7 @@ private:
public:
EdgeSelector_Length(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx)
Selector<PFP>(m, pos, approx)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
}
......@@ -169,7 +169,7 @@ public:
} ;
template <typename PFP>
class EdgeSelector_QEM : public EdgeSelector<PFP>
class EdgeSelector_QEM : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -200,7 +200,7 @@ private:
public:
EdgeSelector_QEM(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
......@@ -221,7 +221,7 @@ public:
} ;
template <typename PFP>
class EdgeSelector_QEMml : public EdgeSelector<PFP>
class EdgeSelector_QEMml : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -252,7 +252,7 @@ private:
public:
EdgeSelector_QEMml(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
......@@ -274,7 +274,7 @@ public:
template <typename PFP>
class EdgeSelector_NormalArea : public EdgeSelector<PFP>
class EdgeSelector_NormalArea : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -306,7 +306,7 @@ private:
public:
EdgeSelector_NormalArea(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
......@@ -328,7 +328,7 @@ public:
template <typename PFP>
class EdgeSelector_Curvature : public EdgeSelector<PFP>
class EdgeSelector_Curvature : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -367,7 +367,7 @@ private:
public:
EdgeSelector_Curvature(MAP& m, VertexAttribute<VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ;
......@@ -427,7 +427,7 @@ public:
template <typename PFP>
class EdgeSelector_CurvatureTensor : public EdgeSelector<PFP>
class EdgeSelector_CurvatureTensor : public Selector<PFP>
{
// TODO : this selector still needs to be tested
public:
......@@ -458,7 +458,7 @@ private:
public:
EdgeSelector_CurvatureTensor(MAP& m, VertexAttribute<VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
edgeangle = m.template getAttribute<REAL, EDGE>("edgeangle") ;
......@@ -486,7 +486,7 @@ public:
template <typename PFP>
class EdgeSelector_MinDetail : public EdgeSelector<PFP>
class EdgeSelector_MinDetail : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -515,7 +515,7 @@ private:
public:
EdgeSelector_MinDetail(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
......@@ -537,7 +537,7 @@ public:
* EDGE NAIVE COLOR METRIC (using QEMml) *
*****************************************************************************************************************/
template <typename PFP>
class EdgeSelector_ColorNaive : public EdgeSelector<PFP>
class EdgeSelector_ColorNaive : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -572,7 +572,7 @@ private:
public:
EdgeSelector_ColorNaive(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_color(-1),
......@@ -599,7 +599,7 @@ public:
* EDGE GEOMETRY+COLOR METRIC (using QEMml and Gradient norm) *
*****************************************************************************************************************/
template <typename PFP>
class EdgeSelector_GeomColOptGradient : public EdgeSelector<PFP>
class EdgeSelector_GeomColOptGradient : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -635,7 +635,7 @@ private:
public:
EdgeSelector_GeomColOptGradient(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_color(-1),
......@@ -680,7 +680,7 @@ public:
* QEM extended to color metric *
*****************************************************************************************************************/
template <typename PFP>
class EdgeSelector_QEMextColor : public EdgeSelector<PFP>
class EdgeSelector_QEMextColor : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -716,7 +716,7 @@ private:
public:
EdgeSelector_QEMextColor(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_color(-1),
......
......@@ -43,7 +43,7 @@ namespace Decimation
* HALF-EDGE MEMORYLESS QEM METRIC *
*****************************************************************************************************************/
template <typename PFP>
class HalfEdgeSelector_QEMml : public EdgeSelector<PFP>
class HalfEdgeSelector_QEMml : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -74,7 +74,7 @@ private:
public:
HalfEdgeSelector_QEMml(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_positionApproximator(NULL)
{
halfEdgeInfo = m.template addAttribute<HalfEdgeInfo, DART>("halfEdgeInfo") ;
......@@ -98,7 +98,7 @@ public:
* HALF-EDGE QEMextColor METRIC *
*****************************************************************************************************************/
template <typename PFP>
class HalfEdgeSelector_QEMextColor : public EdgeSelector<PFP>
class HalfEdgeSelector_QEMextColor : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -134,7 +134,7 @@ private:
public:
HalfEdgeSelector_QEMextColor(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_color(-1),
......@@ -186,7 +186,7 @@ public:
* HALF-EDGE COLOR GRADIENT ERR *
*****************************************************************************************************************/
template <typename PFP>
class HalfEdgeSelector_ColorGradient : public EdgeSelector<PFP>
class HalfEdgeSelector_ColorGradient : public Selector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
......@@ -225,7 +225,7 @@ private:
public:
HalfEdgeSelector_ColorGradient(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
Selector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_color(-1),
......
......@@ -41,36 +41,40 @@ enum SelectorType
{
// EDGE selectors
// Topo criteria
S_MapOrder = 0,
S_Random = 1,
S_MapOrder = 0, /**< Prioritizes edges in topological order. Requires a geometry approximator. */
S_Random = 1, /**< Prioritizes edges in random order. Requires a geometry approximator. */
// Geom criteria
S_EdgeLength = 2,
S_QEM = 3,
S_QEMml = 4,
S_MinDetail = 5,
S_Curvature = 6,
S_NormalArea = 7,
S_CurvatureTensor = 8,
S_EdgeLength = 2, /**< Prioritizes edges in increasing order of their lengths. Requires a geometry approximator. */
S_QEM = 3, /**< Prioritizes by their quadric error metric (QEM) error [GH97]. Requires a geometry approximator. */
S_QEMml = 4, /**< Prioritizes edges by their "memoryless" quadric error metric (QEM) error [Hop99]. Requires a geometry approximator. */
S_MinDetail = 5, /**< Requires a geometry approximator. */
S_Curvature = 6, /**< Requires a geometry approximator. */
S_NormalArea = 7, /**< EXPERIMENTAL Prioritizes edges ranked by their normal times area measure [Sauvage]. Requires a geometry approximator. */
S_CurvatureTensor = 8, /**< Requires a geometry approximator. */
// Geom + color criteria
S_ColorNaive = 9,
S_QEMextColor = 10,
S_GeomColOptGrad = 11,
S_ColorNaive = 9, /**< Prioritizes edges by a sum of the QEM measure on geometry and the L2 distance between RGB colors of both adjacent vertices. Requires a geometry approximator. Requires a color approximator. */
S_QEMextColor = 10, /**< Prioritizes edges by the quadric error metric (QEM) error extended in R^6 (x,y,z,R,G,B) [GH98]. Requires a geometry approximator. Requires a color approximator. */
S_GeomColOptGrad = 11, /**< EXPERIMENTAL. Requires a geometry approximator. Requires a color approximator. */
// HALF-EDGE selectors
// Geom criteria
S_hQEMml = 12,
S_hQEMml = 12, /**< Prioritizes half-edges according to the quadric error metric (QEM) of the considered collapse [Hop99]. Requires a geometry approximator. */
// Geom + color criteria
S_hQEMextColor = 13,
S_hColorGradient = 14,
S_hQEMextColor = 13, /**< Prioritizes half-edges by the quadric error metric (QEM) error extended in R^6 (x,y,z,R,G,B) [GH98]. Requires a geometry approximator. Requires a color approximator. */
S_hColorGradient = 14, /**< EXPERIMENTAL Prioritizes half-edges according to the sum of the quadric error metric (QEM) for geometry and the gradient color deviation metric of [Vanhoey,Sauvage]. Requires a geometry approximator. Requires a color approximator. */
S_OTHER // for extensions use this type
S_OTHER /**< Can be used for extensions. */
} ;
template <typename PFP> class ApproximatorGen ;
template <typename PFP, typename T, unsigned int ORBIT> class Approximator ;
/*!
* \class Selector
* \brief Generic class for selectors
*/
template <typename PFP>
class EdgeSelector
class Selector
{
public:
typedef typename PFP::MAP MAP ;
......@@ -83,10 +87,10 @@ protected:
std::vector<ApproximatorGen<PFP>*>& m_approximators ;
public:
EdgeSelector(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
Selector(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
m_map(m), m_position(pos), m_approximators(approx)
{}
virtual ~EdgeSelector()
virtual ~Selector()
{}
virtual SelectorType getType() = 0 ;
virtual bool init() = 0 ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment