Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
bb0f0406
Commit
bb0f0406
authored
Apr 19, 2013
by
Kenneth Vanhoey
Browse files
cleanup of all files in namespace ALGO::SURFACE::DECIMATION
parent
b64fb9aa
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
include/Algo/Decimation/approximator.h
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -41,21 +41,26 @@ namespace Decimation
enum
ApproximatorType
{
// One approx per edge
// Geometry approximators
A_QEM
=
0
,
A_MidEdge
=
1
,
A_CornerCutting
=
2
,
A_TangentPredict1
=
3
,
A_TangentPredict2
=
4
,
A_NormalArea
=
5
,
// Geometry + color approximators
A_ColorNaive
=
6
,
A_ColorQEMext
=
7
,
A_GeomColorOpt
=
8
,
A_Lightfield
=
9
,
// note: the following "h" prefix means that half-edges are prioritized instead of edges.
A_hHalfCollapse
=
10
,
A_hQEM
=
11
,
A_hLightfieldHalf
=
12
,
A_MidEdgeLFopt
=
13
// One approx per half-edge
// Generic (considers all provided attributes) approximator
A_hHalfCollapse
=
9
,
// Geometry approximator
A_hQEM
=
10
,
A_OTHER
// for extensions use this type
}
;
template
<
typename
PFP
>
...
...
@@ -147,16 +152,6 @@ public:
return
m_attrV
[
index
]
->
name
()
;
}
// std::vector<std::string> getApproximatedAttributeNames() const
// {
// std::vector<std::string> names ;
// names.resize(m_attrV.size()) ;
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// names[i] = m_attrV[i]->name() ;
//
// return names ;
// }
unsigned
int
getNbApproximated
()
const
{
return
m_attrV
.
size
()
;
...
...
include/Algo/Decimation/colorPerVertexApproximator.h
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -160,7 +160,7 @@ public:
}
//namespace Decimation
}
}
// namespace Surface
}
//namespace Algo
...
...
include/Algo/Decimation/colorPerVertexApproximator.hpp
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
include/Algo/Decimation/decimation.h
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -76,6 +76,7 @@ int decimate(
* \param s the selector
* \param a a vector containing the approximators
* \param nbWantedVertices the aimed amount of vertices after decimation
* \param recomputePriorityList if false and a priority list exists, it is not recomputed
* \param edgeErrors will (if not null) contain the edge errors computed by the approximator/selector (default NULL)
* \param callback_wrapper a callback function for progress monitoring (default NULL)
* \param callback_object the object to call the callback on (default NULL)
...
...
@@ -88,6 +89,7 @@ int decimate(
EdgeSelector
<
PFP
>*
s
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
a
,
unsigned
int
nbWantedVertices
,
bool
recomputePriorityList
=
true
,
EdgeAttribute
<
typename
PFP
::
REAL
>
*
edgeErrors
=
NULL
,
void
(
*
callback_wrapper
)(
void
*
,
const
void
*
)
=
NULL
,
void
*
callback_object
=
NULL
)
;
...
...
include/Algo/Decimation/decimation.hpp
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -43,7 +43,7 @@ int decimate(
)
{
assert
(
attribs
.
size
()
>=
1
||
!
"Decimate: not enough attribs provided"
)
;
assert
(
attribs
[
0
]
->
name
()
==
"position"
||
!
"Decimate: first attribute
is not
position"
)
;
assert
(
attribs
[
0
]
->
name
()
==
"position"
||
!
"Decimate: first attribute
should always be the
position"
)
;
VertexAttribute
<
typename
PFP
::
VEC3
>
position
=
*
(
attribs
[
0
])
;
std
::
vector
<
ApproximatorGen
<
PFP
>*>
approximators
;
...
...
@@ -106,69 +106,6 @@ int decimate(
// pos
approximators
.
push_back
(
new
Approximator_QEMhalfEdge
<
PFP
>
(
map
,
attribs
))
;
break
;
/*case A_hLightfieldHalf:
{
v_approx = new std::vector<VertexAttribute<typename PFP::VEC3>* >[3] ;
// pos
v_approx[0].push_back(attribs[0]) ;
approximators.push_back(new Approximator_HalfCollapse<PFP>(map, v_approx[0])) ;
// frame
assert(attribs.size() >= 4 || !"Decimate: A_hLightfieldHalf --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < 3 ; ++i)
v_approx[1].push_back(attribs[i+1]) ;
approximators.push_back(new Approximator_FrameInterpolationHalfEdge<PFP>(map, v_approx[1])) ;
// hemifunction
assert(attribs.size() >= 5 || !"Decimate: A_hLightfieldHalf --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < attribs.size() - 4 ; ++i)
v_approx[2].push_back(attribs[i+4]) ;
approximators.push_back(new Approximator_HemiFuncCoefsHalfEdge<PFP>(map, v_approx[2])) ;
}
break ;
case A_Lightfield :
{
v_approx = new std::vector<VertexAttribute<typename PFP::VEC3>* >[3] ;
// pos
v_approx[0].push_back(attribs[0]) ;
approximators.push_back(new Approximator_QEM<PFP>(map, v_approx[0])) ;
// frame
assert(attribs.size() >= 4 || !"Decimate: A_Lightfield --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < 3 ; ++i)
v_approx[1].push_back(attribs[i+1]) ;
approximators.push_back(new Approximator_FrameInterpolation<PFP>(map, v_approx[1])) ;
// hemifunction
assert(attribs.size() >= 5 || !"Decimate: A_Lightfield --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < attribs.size() - 4 ; ++i)
v_approx[2].push_back(attribs[i+4]) ;
approximators.push_back(new Approximator_HemiFuncCoefs<PFP>(map, v_approx[2])) ;
}
break ;
case A_MidEdgeLFopt :
{
v_approx = new std::vector<VertexAttribute<typename PFP::VEC3>* >[3] ;
// pos
v_approx[0].push_back(attribs[0]) ;
approximators.push_back(new Approximator_MidEdge<PFP>(map, v_approx[0])) ;
// frame
assert(attribs.size() >= 4 || !"Decimate: A_MidEdgeLFopt --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < 3 ; ++i)
v_approx[1].push_back(attribs[i+1]) ;
approximators.push_back(new Approximator_FrameInterpolation<PFP>(map, v_approx[1])) ;
// hemifunction
assert(attribs.size() >= 5 || !"Decimate: A_MidEdgeLFopt --> not enough attribs provided") ;
for (unsigned int i = 0 ; i < attribs.size() - 4 ; ++i)
v_approx[2].push_back(attribs[i+4]) ;
approximators.push_back(new Approximator_HemiFuncCoefs<PFP>(map, v_approx[2])) ;
}
break ;*/
}
switch
(
s
)
...
...
@@ -212,42 +149,12 @@ int decimate(
case
S_hQEMml
:
selector
=
new
HalfEdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
case
S_hColorExperimental
:
selector
=
new
HalfEdgeSelector_ColorExperimental
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
case
S_hColorGradient
:
selector
=
new
HalfEdgeSelector_ColorGradient
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
case
S_GeomColOptGrad
:
selector
=
new
EdgeSelector_GeomColOptGradient
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
/*case S_Lightfield :
selector = new EdgeSelector_Lightfield<PFP>(map, position, approximators) ;
break ;
case S_hLightfield :
selector = new HalfEdgeSelector_Lightfield<PFP>(map, position, approximators) ;
break ;
case S_hLightfieldAvgColor :
selector = new HalfEdgeSelector_LightfieldAvgColor<PFP>(map, position, approximators) ;
break ;
case S_hLightfieldKCL :
selector = new HalfEdgeSelector_LightfieldKCL<PFP>(map, position, approximators) ;
break ;
case S_hLFexperimental:
selector = new HalfEdgeSelector_LFexperimental<PFP>(map, position, approximators) ;
break ;
case S_hLFgradient:
selector = new HalfEdgeSelector_LFgradient<PFP>(map, position, approximators) ;
break ;
case S_hColorPerFace:
selector = new HalfEdgeSelector_ColorPerFace<PFP>(map, position, approximators) ;
break ;
case S_hLFperFace:
selector = new HalfEdgeSelector_LFperFace<PFP>(map, position, approximators) ;
break ;
case S_LightfieldGradient:
selector = new EdgeSelector_LightfieldGradient<PFP>(map, position, approximators) ;
break ;*/
}
int
status
=
decimate
(
map
,
selector
,
approximators
,
nbWantedVertices
,
edgeErrors
,
callback_wrapper
,
callback_object
)
;
...
...
@@ -267,19 +174,23 @@ int decimate(
typename
PFP
::
MAP
&
map
,
EdgeSelector
<
PFP
>*
selector
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approximators
,
unsigned
int
nbWantedVertices
,
EdgeAttribute
<
typename
PFP
::
REAL
>
*
edgeErrors
=
NULL
,
void
(
*
callback_wrapper
)(
void
*
,
const
void
*
)
=
NULL
,
void
*
callback_object
=
NULL
bool
recomputePriorityList
,
EdgeAttribute
<
typename
PFP
::
REAL
>
*
edgeErrors
,
void
(
*
callback_wrapper
)(
void
*
,
const
void
*
),
void
*
callback_object
)
{
for
(
typename
std
::
vector
<
ApproximatorGen
<
PFP
>*>::
iterator
it
=
approximators
.
begin
();
it
!=
approximators
.
end
();
++
it
)
(
*
it
)
->
init
()
;
if
(
!
selector
->
init
())
return
-
1
;
// init failed
Dart
d
;
if
(
recomputePriorityList
||
!
selector
->
nextEdge
(
d
))
{
if
(
!
selector
->
init
())
return
-
1
;
// init failed
}
unsigned
int
nbVertices
=
map
.
template
getNbOrbits
<
VERTEX
>()
;
bool
finished
=
false
;
Dart
d
;
while
(
!
finished
)
{
...
...
include/Algo/Decimation/edgeSelector.h
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -28,8 +28,6 @@
#include
"Algo/Decimation/selector.h"
#include
"Algo/Decimation/approximator.h"
#include
"Algo/Geometry/boundingbox.h"
//#include "Container/fakeAttribute.h"
#include
"Utils/qem.h"
#include
"Algo/Geometry/normal.h"
#include
"Algo/Selection/collector.h"
...
...
@@ -67,7 +65,7 @@ public:
{}
SelectorType
getType
()
{
return
S_MapOrder
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
{}
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -99,7 +97,7 @@ public:
{}
SelectorType
getType
()
{
return
S_Random
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d2
)
{}
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -145,7 +143,7 @@ public:
}
SelectorType
getType
()
{
return
S_EdgeLength
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -215,7 +213,7 @@ public:
}
SelectorType
getType
()
{
return
S_QEM
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -267,7 +265,7 @@ public:
}
SelectorType
getType
()
{
return
S_QEMml
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -321,7 +319,7 @@ public:
}
SelectorType
getType
()
{
return
S_NormalArea
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -420,7 +418,7 @@ public:
}
SelectorType
getType
()
{
return
S_Curvature
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -479,7 +477,7 @@ public:
}
SelectorType
getType
()
{
return
S_CurvatureTensor
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -528,7 +526,7 @@ public:
}
SelectorType
getType
()
{
return
S_MinDetail
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -590,7 +588,7 @@ public:
}
SelectorType
getType
()
{
return
S_ColorNaive
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -653,7 +651,7 @@ public:
}
SelectorType
getType
()
{
return
S_GeomColOptGrad
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -734,7 +732,7 @@ public:
}
SelectorType
getType
()
{
return
S_QEMextColor
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
bool
nextEdge
(
Dart
&
d
)
const
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
...
...
@@ -759,214 +757,9 @@ public:
}
}
;
/*****************************************************************************************************************
* LIGHTFIELD QUADRIC ERROR METRIC *
*****************************************************************************************************************
template <typename PFP>
class EdgeSelector_Lightfield : public EdgeSelector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
private:
typedef struct
{
typename std::multimap<float,Dart>::iterator it ;
bool valid ;
static std::string CGoGNnameOfType() { return "QEMextColorEdgeInfo" ; }
} LightfieldEdgeInfo ;
typedef NoMathIOAttribute<LightfieldEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<VEC3> m_pos, m_frameT, m_frameB, m_frameN, m_avgColor ;
std::vector<VertexAttribute<VEC3> > m_HF ;
int m_approxindex_pos, m_attrindex_pos ;
int m_approxindex_FN, m_attrindex_FN ;
std::vector<unsigned int> m_approxindex_HF, m_attrindex_HF ;
unsigned int m_K ;
VertexAttribute<Utils::Quadric<REAL> > m_quadricGeom ;
EdgeAttribute<Utils::QuadricHF<REAL> > m_quadricHF ;
std::vector<Approximator<PFP, typename PFP::VEC3, EDGE>* > m_approx ;
std::multimap<float,Dart> edges ;
typename std::multimap<float,Dart>::iterator cur ;
void initEdgeInfo(Dart d) ;
void updateEdgeInfo(Dart d, bool recompute) ;
void computeEdgeInfo(Dart d,EdgeInfo& einfo) ;
void recomputeQuadric(const Dart d, const bool recomputeNeighbors = false) ;
public:
EdgeSelector_Lightfield(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_FN(-1),
m_attrindex_FN(-1),
m_K(0)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
m_quadricGeom = m.template addAttribute<Utils::Quadric<REAL>, VERTEX>("QEMquadric") ;
m_quadricHF = m.template getAttribute<Utils::QuadricHF<REAL>, EDGE>("HFquadric") ;
m_avgColor = m.template getAttribute<typename PFP::VEC3, VERTEX>("color") ;
assert(m_avgColor.isValid()) ;
}
~EdgeSelector_Lightfield()
{
this->m_map.removeAttribute(edgeInfo) ;
this->m_map.removeAttribute(m_quadricGeom) ;
}
SelectorType getType() { return S_Lightfield ; }
bool init() ;
bool nextEdge(Dart& d) ;
void updateBeforeCollapse(Dart d) ;
void updateAfterCollapse(Dart d2, Dart dd2) ;
void updateWithoutCollapse() { }
void getEdgeErrors(EdgeAttribute<typename PFP::REAL> *errors) const
{
assert(errors != NULL || !"EdgeSelector::setColorMap requires non null vertexattribute argument") ;
if (!errors->isValid())
std::cerr << "EdgeSelector::setColorMap requires valid edgeattribute argument" << std::endl ;
assert(edgeInfo.isValid()) ;
TraversorE<typename PFP::MAP> travE(this->m_map) ;
for(Dart d = travE.begin() ; d != travE.end() ; d = travE.next())
{
if (edgeInfo[d].valid)
{
(*errors)[d] = edgeInfo[d].it->first ;
}
else
(*errors)[d] = -1 ;
}
}
} ;
/*****************************************************************************************************************
* LIGHTFIELD QUADRIC ERROR METRIC *
*****************************************************************************************************************
template <typename PFP>
class EdgeSelector_LightfieldGradient : public EdgeSelector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
private:
typedef struct
{
typename std::multimap<float,Dart>::iterator it ;
bool valid ;
static std::string CGoGNnameOfType() { return "LightfieldGradientEdgeInfo" ; }
} LightfieldEdgeInfo ;
typedef NoMathIOAttribute<LightfieldEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > m_quadric ;
VertexAttribute<VEC3> m_avgColor ;
int m_approxindex_pos, m_attrindex_pos ;
int m_approxindex_FT, m_attrindex_FT ;
int m_approxindex_FB, m_attrindex_FB ;
int m_approxindex_FN, m_attrindex_FN ;
std::vector<unsigned int> m_approxindex_HF, m_attrindex_HF ;
unsigned int m_K ;
SphericalFunctionIntegratorCartesian m_integrator ;
double *m_n ;
double *m_workspace ;
std::vector<Approximator<PFP, typename PFP::VEC3, EDGE>* > m_approx ;
std::multimap<float,Dart> edges ;
typename std::multimap<float,Dart>::iterator cur ;
void initEdgeInfo(Dart d) ;
void updateEdgeInfo(Dart d) ;
void computeEdgeInfo(Dart d,EdgeInfo& einfo) ;
void recomputeQuadric(const Dart d, const bool recomputeNeighbors = false) ;
VEC3 computeDirDerivativeLFerror(const Dart& v) const ;
VEC3 integrateDlf(const VEC3& d, const unsigned int& K, const VEC3& N, const VEC3& ei, const VEC3& ej,
const VEC3* coefs0, const VEC3& T0, const VEC3& B0, const VEC3& N0, const VEC3& avg0,
const VEC3* coefs1, const VEC3& T1, const VEC3& B1, const VEC3& N1, const VEC3& avg1,
const VEC3* coefsi, const VEC3& Ti, const VEC3& Bi, const VEC3& Ni, const VEC3& avgi,
const VEC3* coefsj, const VEC3& Tj, const VEC3& Bj, const VEC3& Nj, const VEC3& avgj) const ;
static bool isInDomain(double x, double y, double z, void *data) ;
static double dlf (double x, double y, double z, void* data) ;
static double evalF(double* N, double* avg, unsigned int nb, double* T, double* B, double* coefs, double& x, double& y, double& z) ;
public:
EdgeSelector_LightfieldGradient(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx) :
EdgeSelector<PFP>(m, pos, approx),
m_approxindex_pos(-1),
m_attrindex_pos(-1),
m_approxindex_FT(-1),
m_attrindex_FT(-1),
m_approxindex_FB(-1),
m_attrindex_FB(-1),
m_approxindex_FN(-1),
m_attrindex_FN(-1),
m_K(0),
m_n(NULL),
m_workspace(NULL)
{
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
m_quadric = m.template addAttribute<Utils::Quadric<REAL>, VERTEX>("QEMquadric") ;
m_avgColor = m.template getAttribute<typename PFP::VEC3, VERTEX>("color") ;
m_n = new double[3] ;
assert(m_avgColor.isValid()) ;
}
~EdgeSelector_LightfieldGradient()
{
this->m_map.removeAttribute(edgeInfo) ;
this->m_map.removeAttribute(m_quadric) ;
m_integrator.Release() ;
delete[] m_workspace ;
delete[] m_n ;
}
SelectorType getType() { return S_LightfieldGradient ; }
bool init() ;
bool nextEdge(Dart& d) ;
void updateBeforeCollapse(Dart d) ;
void updateAfterCollapse(Dart d2, Dart dd2) ;
void updateWithoutCollapse() { }
void getEdgeErrors(EdgeAttribute<typename PFP::REAL> *errors) const
{
assert(errors != NULL || !"EdgeSelector::setColorMap requires non null vertexattribute argument") ;
if (!errors->isValid())
std::cerr << "EdgeSelector::setColorMap requires valid edgeattribute argument" << std::endl ;
assert(edgeInfo.isValid()) ;
TraversorE<typename PFP::MAP> travE(this->m_map) ;
for(Dart d = travE.begin() ; d != travE.end() ; d = travE.next())
{
if (edgeInfo[d].valid)
{
(*errors)[d] = edgeInfo[d].it->first ;
}
else
(*errors)[d] = -1 ;
}
}
} ;
*/
}
// namespace Decimation
}
}
// namespace Surface
}
// namespace Algo
...
...
include/Algo/Decimation/edgeSelector.hpp
View file @
bb0f0406
This diff is collapsed.
Click to expand it.
include/Algo/Decimation/geometryApproximator.h
View file @
bb0f0406
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-201
2
, IGG Team,
LSIIT
, University of Strasbourg *
* Copyright (C) 2009-201
3
, IGG Team,
ICube
, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
...
...
@@ -158,7 +158,6 @@ public:
typedef
typename
PFP
::
REAL
REAL
;
protected:
// VertexAttribute<Utils::Quadric<REAL> > m_quadric ;
EdgeAttribute
<
Geom
::
Matrix
<
3
,
3
,
REAL
>
>
edgeMatrix
;
public:
...
...
@@ -177,7 +176,7 @@ public: