Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
a07476af
Commit
a07476af
authored
Jan 15, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~vanhoey/CGoGN
parents
548b6638
8058dafc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
618 additions
and
212 deletions
+618
-212
include/Algo/Decimation/approximator.h
include/Algo/Decimation/approximator.h
+5
-163
include/Algo/Decimation/decimation.hpp
include/Algo/Decimation/decimation.hpp
+4
-1
include/Algo/Decimation/halfEdgeSelector.h
include/Algo/Decimation/halfEdgeSelector.h
+123
-15
include/Algo/Decimation/halfEdgeSelector.hpp
include/Algo/Decimation/halfEdgeSelector.hpp
+472
-20
include/Algo/Decimation/lightfieldApproximator.hpp
include/Algo/Decimation/lightfieldApproximator.hpp
+10
-10
include/Algo/Decimation/selector.h
include/Algo/Decimation/selector.h
+2
-1
include/Utils/qem.h
include/Utils/qem.h
+1
-1
include/Utils/qem.hpp
include/Utils/qem.hpp
+1
-1
No files found.
include/Algo/Decimation/approximator.h
View file @
a07476af
...
...
@@ -178,6 +178,11 @@ public:
return
m_approx
[
index
][
d
]
;
}
const
VertexAttribute
<
T
>&
getAttr
(
unsigned
int
index
=
0
)
const
{
return
*
(
m_attrV
[
index
])
;
}
std
::
vector
<
T
>
getAllApprox
(
Dart
d
)
const
{
std
::
vector
<
T
>
res
;
...
...
@@ -249,169 +254,6 @@ public:
}
}
;
//template <typename PFP, typename T>
//class ApproximatorEdge : public ApproximatorGen<PFP>
//{
//public:
// typedef typename PFP::MAP MAP ;
// typedef typename PFP::VEC3 VEC3 ;
// typedef typename PFP::REAL REAL ;
//
//protected:
// Predictor<PFP, T>* m_predictor ;
//
// std::vector<VertexAttribute<T>* > m_attrV ; // vertex attributes to be approximated
// std::vector<EdgeAttribute<T> > m_approx ; // attributes to store approximation result
// std::vector<EdgeAttribute<T> > m_detail ; // attributes to store detail information for reconstruction
// std::vector<T> m_app ;
//
//public:
// ApproximatorEdge(MAP& m, std::vector<VertexAttribute<T>* > va, Predictor<PFP, T> * predictor) :
// ApproximatorGen<PFP>(m), m_predictor(predictor), m_attrV(va)
// {
// const unsigned int& size = m_attrV.size() ;
// assert(size > 0 || !"ApproximatorEdge: no attributes provided") ;
//
// m_approx.resize(size) ;
// m_detail.resize(size) ;
// m_app.resize(size) ;
//
// for (unsigned int i = 0 ; i < size ; ++i)
// {
// if (!m_attrV[i]->isValid())
// std::cerr << "ApproximatorEdge Warning: attribute number " << i << " is not valid" << std::endl ;
//
// std::stringstream aname ;
// aname << "approx_" << m_attrV[i]->name() ;
// m_approx[i] = this->m_map.template addAttribute<T, EDGE>(aname.str()) ;
//
// if(m_predictor) // if predictors are associated to the approximator
// { // create attributes to store the details needed for reconstruction
// std::stringstream dname ;
// dname << "detail_" << m_attrV[i]->name() ;
// m_detail[i] = this->m_map.template addAttribute<T, EDGE>(dname.str()) ;
// }
// }
// }
//
// virtual ~ApproximatorEdge()
// {
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// {
// this->m_map.template removeAttribute(m_approx[i]) ;
// if(m_predictor)
// this->m_map.template removeAttribute(m_detail[i]) ;
// }
// }
//
// const std::string& getApproximatedAttributeName(unsigned int index = 0) const
// {
// 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() ;
// }
//
// void saveApprox(Dart d)
// {
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// m_app[i] = m_approx[i][d] ;
// }
//
// void affectApprox(Dart d)
// {
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// m_attrV[i]->operator[](d) = m_app[i] ;
// }
//
// const T& getApprox(Dart d, unsigned int index = 0) const
// {
// return m_approx[index][d] ;
// }
//
// std::vector<T> getAllApprox(Dart d) const
// {
// std::vector<T> res ;
// res.resize(m_attrV.size()) ;
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// res[i] = m_approx[i][d] ;
//
// return res ;
// }
//
// const Predictor<PFP, T>* getPredictor() const
// {
// return m_predictor ;
// }
//
// const T& getDetail(Dart d, unsigned int index = 0) const
// {
// assert(m_predictor || !"Trying to get detail on a non-predictive scheme") ;
// return m_detail[index][d] ;
// }
//
// std::vector<T> getAllDetail(Dart d) const
// {
// assert(m_predictor || !"Trying to get detail on a non-predictive scheme") ;
//
// std::vector<T> res ;
// res.resize(m_attrV.size()) ;
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// res[i] = m_detail[i][d] ;
// return res ;
// }
//
// void setDetail(Dart d, unsigned int index, T& val)
// {
// assert(m_predictor || !"Trying to set detail on a non-predictive scheme") ;
// m_detail[index][d] = val ;
// }
//
// void setDetail(Dart d, std::vector<T>& val)
// {
// assert(m_predictor || !"Trying to set detail on a non-predictive scheme") ;
//
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// m_detail[index][d] = val[i] ;
// }
//
//
//// // TODO works only for vector types !!
//// REAL detailMagnitude(Dart d)
//// {
//// assert(m_predictor || !"Trying to get detail magnitude on a non-predictive scheme") ;
//// return m_detail[d].norm2() ;
//// }
//
// void addDetail(Dart d, double amount, bool sign, typename PFP::MATRIX33* detailTransform)
// {
// assert(m_predictor || !"Trying to add detail on a non-predictive scheme") ;
//
// for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
// {
// T det = m_detail[i][d] ;
// if(detailTransform)
// det = (*detailTransform) * det ;
// det *= amount ;
// if(!sign)
// det *= REAL(-1) ;
// m_attrV[i]->operator[](d) += det ;
// }
// }
//} ;
}
//namespace Decimation
}
// surface
...
...
include/Algo/Decimation/decimation.hpp
View file @
a07476af
...
...
@@ -105,7 +105,7 @@ void decimate(
// pos
v_approx
[
0
].
push_back
(
attribs
[
0
])
;
approximators
.
push_back
(
new
Approximator_
QEMhalfEdg
e
<
PFP
>
(
map
,
v_approx
[
0
]))
;
approximators
.
push_back
(
new
Approximator_
HalfCollaps
e
<
PFP
>
(
map
,
v_approx
[
0
]))
;
// frame
assert
(
attribs
.
size
()
>=
4
||
!
"Decimate: A_hLightfieldHalf --> not enough attribs provided"
)
;
...
...
@@ -193,6 +193,9 @@ void decimate(
case
S_hLightfieldExp
:
selector
=
new
HalfEdgeSelector_LightfieldExp
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_hLightfieldKCL
:
selector
=
new
HalfEdgeSelector_LightfieldKCL
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
}
for
(
typename
std
::
vector
<
ApproximatorGen
<
PFP
>*>::
iterator
it
=
approximators
.
begin
();
it
!=
approximators
.
end
();
++
it
)
...
...
include/Algo/Decimation/halfEdgeSelector.h
View file @
a07476af
...
...
@@ -166,12 +166,16 @@ public:
TraversorE
<
typename
PFP
::
MAP
>
travE
(
this
->
m_map
)
;
for
(
Dart
d
=
travE
.
begin
()
;
d
!=
travE
.
end
()
;
d
=
travE
.
next
())
{
(
*
errors
)[
d
]
=
-
1
;
if
(
halfEdgeInfo
[
d
].
valid
)
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
d
].
it
->
first
;
}
else
(
*
errors
)[
d
]
=
-
1
;
Dart
dd
=
this
->
m_map
.
phi2
(
d
)
;
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
dd
].
it
->
first
<
(
*
errors
)[
d
])
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
dd
].
it
->
first
;
}
}
}
}
;
...
...
@@ -193,9 +197,9 @@ private:
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
static
std
::
string
CGoGNnameOfType
()
{
return
"
QEMextColor
HalfEdgeInfo"
;
}
}
QEMextColor
HalfEdgeInfo
;
typedef
NoMathIOAttribute
<
QEMextColor
HalfEdgeInfo
>
HalfEdgeInfo
;
static
std
::
string
CGoGNnameOfType
()
{
return
"
Lightfield
HalfEdgeInfo"
;
}
}
Lightfield
HalfEdgeInfo
;
typedef
NoMathIOAttribute
<
Lightfield
HalfEdgeInfo
>
HalfEdgeInfo
;
DartAttribute
<
HalfEdgeInfo
>
halfEdgeInfo
;
...
...
@@ -261,7 +265,7 @@ public:
(
*
errors
)[
d
]
=
halfEdgeInfo
[
d
].
it
->
first
;
}
Dart
dd
=
this
->
m_map
.
phi2
(
d
)
;
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
d
].
it
->
first
<
(
*
errors
)[
d
])
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
d
d
].
it
->
first
<
(
*
errors
)[
d
])
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
dd
].
it
->
first
;
}
...
...
@@ -286,9 +290,9 @@ private:
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
static
std
::
string
CGoGNnameOfType
()
{
return
"
QEMextColor
HalfEdgeInfo"
;
}
}
QEMextColor
HalfEdgeInfo
;
typedef
NoMathIOAttribute
<
QEMextColor
HalfEdgeInfo
>
HalfEdgeInfo
;
static
std
::
string
CGoGNnameOfType
()
{
return
"
Lightfield
HalfEdgeInfo"
;
}
}
Lightfield
HalfEdgeInfo
;
typedef
NoMathIOAttribute
<
Lightfield
HalfEdgeInfo
>
HalfEdgeInfo
;
DartAttribute
<
HalfEdgeInfo
>
halfEdgeInfo
;
...
...
@@ -301,7 +305,6 @@ private:
int
m_approxindex_FN
,
m_attrindex_FN
;
std
::
vector
<
unsigned
int
>
m_approxindex_HF
,
m_attrindex_HF
;
unsigned
int
m_K
;
int
m_approxindex_color
,
m_attrindex_color
;
std
::
vector
<
Approximator
<
PFP
,
typename
PFP
::
VEC3
,
DART
>*
>
m_approx
;
...
...
@@ -320,9 +323,7 @@ public:
m_attrindex_pos
(
-
1
),
m_approxindex_FN
(
-
1
),
m_attrindex_FN
(
-
1
),
m_K
(
0
),
m_approxindex_color
(
-
1
),
m_attrindex_color
(
-
1
)
m_K
(
0
)
{
halfEdgeInfo
=
m
.
template
addAttribute
<
HalfEdgeInfo
,
DART
>(
"halfEdgeInfo"
)
;
m_quadricGeom
=
m
.
template
addAttribute
<
Utils
::
Quadric
<
REAL
>,
VERTEX
>
(
"QEMquadric"
)
;
...
...
@@ -335,7 +336,113 @@ public:
this
->
m_map
.
removeAttribute
(
m_quadricGeom
)
;
this
->
m_map
.
removeAttribute
(
halfEdgeInfo
)
;
}
SelectorType
getType
()
{
return
S_hLightfield
;
}
SelectorType
getType
()
{
return
S_hLightfieldExp
;
}
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
)
{
assert
(
errors
!=
NULL
||
!
"EdgeSelector::setColorMap requires non null vertexattribute argument"
)
;
if
(
!
errors
->
isValid
())
std
::
cerr
<<
"EdgeSelector::setColorMap requires valid edgeattribute argument"
<<
std
::
endl
;
assert
(
halfEdgeInfo
.
isValid
())
;
TraversorE
<
typename
PFP
::
MAP
>
travE
(
this
->
m_map
)
;
for
(
Dart
d
=
travE
.
begin
()
;
d
!=
travE
.
end
()
;
d
=
travE
.
next
())
{
(
*
errors
)[
d
]
=
-
1
;
if
(
halfEdgeInfo
[
d
].
valid
)
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
d
].
it
->
first
;
}
Dart
dd
=
this
->
m_map
.
phi2
(
d
)
;
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
dd
].
it
->
first
<
(
*
errors
)[
d
])
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
dd
].
it
->
first
;
}
}
}
}
;
/*****************************************************************************************************************
* HALF-EDGE LIGHTFIELD METRIC KCL08-like *
*****************************************************************************************************************/
template
<
typename
PFP
>
class
HalfEdgeSelector_LightfieldKCL
:
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
"LightfieldHalfEdgeInfo"
;
}
}
LightfieldHalfEdgeInfo
;
typedef
NoMathIOAttribute
<
LightfieldHalfEdgeInfo
>
HalfEdgeInfo
;
DartAttribute
<
HalfEdgeInfo
>
halfEdgeInfo
;
VertexAttribute
<
Utils
::
Quadric
<
REAL
>
>
m_quadricGeom
;
VertexAttribute
<
REAL
>
m_visualImportance
;
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
;
REAL
tmpVisualImportance
;
std
::
vector
<
Approximator
<
PFP
,
typename
PFP
::
VEC3
,
DART
>*
>
m_approx
;
std
::
multimap
<
float
,
Dart
>
halfEdges
;
typename
std
::
multimap
<
float
,
Dart
>::
iterator
cur
;
void
initHalfEdgeInfo
(
Dart
d
)
;
void
updateHalfEdgeInfo
(
Dart
d
,
bool
recompute
)
;
void
computeHalfEdgeInfo
(
Dart
d
,
HalfEdgeInfo
&
einfo
)
;
void
recomputeQuadric
(
const
Dart
d
,
const
bool
recomputeNeighbors
=
false
)
;
REAL
computeLightfieldError
(
Dart
v0
)
;
REAL
computeSquaredLightfieldDifference
(
Dart
d1
,
Dart
d2
)
;
public:
HalfEdgeSelector_LightfieldKCL
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
allDarts
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
),
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
)
{
halfEdgeInfo
=
m
.
template
addAttribute
<
HalfEdgeInfo
,
DART
>(
"halfEdgeInfo"
)
;
m_quadricGeom
=
m
.
template
addAttribute
<
Utils
::
Quadric
<
REAL
>,
VERTEX
>
(
"QEMquadric"
)
;
m_visualImportance
=
m
.
template
addAttribute
<
typename
PFP
::
REAL
,
VERTEX
>(
"VisualImportance"
)
;
m_avgColor
=
m
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"color"
)
;
assert
(
m_avgColor
.
isValid
())
;
}
~
HalfEdgeSelector_LightfieldKCL
()
{
this
->
m_map
.
removeAttribute
(
m_quadricGeom
)
;
this
->
m_map
.
removeAttribute
(
halfEdgeInfo
)
;
this
->
m_map
.
removeAttribute
(
m_visualImportance
)
;
}
SelectorType
getType
()
{
return
S_hLightfieldKCL
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d
)
;
...
...
@@ -359,10 +466,11 @@ public:
(
*
errors
)[
d
]
=
halfEdgeInfo
[
d
].
it
->
first
;
}
Dart
dd
=
this
->
m_map
.
phi2
(
d
)
;
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
d
].
it
->
first
<
(
*
errors
)[
d
])
if
(
halfEdgeInfo
[
dd
].
valid
&&
halfEdgeInfo
[
d
d
].
it
->
first
<
(
*
errors
)[
d
])
{
(
*
errors
)[
d
]
=
halfEdgeInfo
[
dd
].
it
->
first
;
}
//m_avgColor[d] = VEC3(m_visualImportance[d]/6.,m_visualImportance[d]/6.,m_visualImportance[d]/6.) ;
}
}
}
;
...
...
include/Algo/Decimation/halfEdgeSelector.hpp
View file @
a07476af
...
...
@@ -189,12 +189,12 @@ void HalfEdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
updateHalfEdgeInfo(vit, true) ;
Dart d = m.phi2(vit) ;
if
(
d
!=
vit
)
;
if (d != vit)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit), true) ;
d = m.phi2(m.phi1(vit)) ;
if
(
d
!=
m
.
phi1
(
vit
))
;
if (d != m.phi1(vit))
updateHalfEdgeInfo(d, true) ;
Dart stop = m.phi2(vit) ;
...
...
@@ -203,12 +203,12 @@ void HalfEdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
do {
updateHalfEdgeInfo(vit2, true) ;
d = m.phi2(vit2) ;
if
(
d
!=
vit2
)
;
if (d != vit2)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit2), false) ;
d = m.phi2(m.phi1(vit2)) ;
if
(
d
!=
m
.
phi1
(
vit2
))
;
if (d != m.phi1(vit2))
updateHalfEdgeInfo(d, false) ;
vit2 = m.phi12(vit2) ;
...
...
@@ -479,12 +479,12 @@ void HalfEdgeSelector_QEMextColor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
updateHalfEdgeInfo(vit, true) ;
Dart d = m.phi2(vit) ;
if
(
d
!=
vit
)
;
if (d != vit)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit), true) ;
d = m.phi2(m.phi1(vit)) ;
if
(
d
!=
m
.
phi1
(
vit
))
;
if (d != m.phi1(vit))
updateHalfEdgeInfo(d, true) ;
Dart stop = m.phi2(vit) ;
...
...
@@ -493,12 +493,12 @@ void HalfEdgeSelector_QEMextColor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
do {
updateHalfEdgeInfo(vit2, true) ;
d = m.phi2(vit2) ;
if
(
d
!=
vit2
)
;
if (d != vit2)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit2), false) ;
d = m.phi2(m.phi1(vit2)) ;
if
(
d
!=
m
.
phi1
(
vit2
))
;
if (d != m.phi1(vit2))
updateHalfEdgeInfo(d, false) ;
vit2 = m.phi12(vit2) ;
...
...
@@ -695,7 +695,6 @@ bool HalfEdgeSelector_Lightfield<PFP>::init()
}
}
m_K = k ;
std
::
cout
<<
m_K
<<
std
::
endl
;
if(ok < 5)
return false ;
...
...
@@ -821,12 +820,12 @@ void HalfEdgeSelector_Lightfield<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
updateHalfEdgeInfo(vit, true) ;
Dart d = m.phi2(vit) ;
if
(
d
!=
vit
)
;
if (d != vit)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit), true) ;
d = m.phi2(m.phi1(vit)) ;
if
(
d
!=
m
.
phi1
(
vit
))
;
if (d != m.phi1(vit))
updateHalfEdgeInfo(d, true) ;
Dart stop = m.phi2(vit) ;
...
...
@@ -835,12 +834,12 @@ void HalfEdgeSelector_Lightfield<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
do {
updateHalfEdgeInfo(vit2, true) ;
d = m.phi2(vit2) ;
if
(
d
!=
vit2
)
;
if (d != vit2)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit2), false) ;
d = m.phi2(m.phi1(vit2)) ;
if
(
d
!=
m
.
phi1
(
vit2
))
;
if (d != m.phi1(vit2))
updateHalfEdgeInfo(d, false) ;
vit2 = m.phi12(vit2) ;
...
...
@@ -1185,12 +1184,12 @@ void HalfEdgeSelector_LightfieldExp<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
updateHalfEdgeInfo(vit, true) ;
Dart d = m.phi2(vit) ;
if
(
d
!=
vit
)
;
if (d != vit)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit), true) ;
d = m.phi2(m.phi1(vit)) ;
if
(
d
!=
m
.
phi1
(
vit
))
;
if (d != m.phi1(vit))
updateHalfEdgeInfo(d, true) ;
Dart stop = m.phi2(vit) ;
...
...
@@ -1199,12 +1198,12 @@ void HalfEdgeSelector_LightfieldExp<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
do {
updateHalfEdgeInfo(vit2, true) ;
d = m.phi2(vit2) ;
if
(
d
!=
vit2
)
;
if (d != vit2)
updateHalfEdgeInfo(d, true) ;
updateHalfEdgeInfo(m.phi1(vit2), false) ;
d = m.phi2(m.phi1(vit2)) ;
if
(
d
!=
m
.
phi1
(
vit2
))
;
if (d != m.phi1(vit2))
updateHalfEdgeInfo(d, false) ;
vit2 = m.phi12(vit2) ;
...
...
@@ -1308,15 +1307,14 @@ void HalfEdgeSelector_LightfieldExp<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeIn
double alpha = alpha1 + alpha2 ;
VEC3 avgColDiff = m_avgColor[d] ;
avgColDiff -= m_avgColor[dd] ;
assert
(
m_quadricHF
.
isValid
()
|
!
"EdgeSelector_Lightfield<PFP>::computeEdgeInfo: quadricHF is not valid"
)
;
assert(m_quadricHF.isValid() | !"EdgeSelector_LightfieldExp<PFP>::computeEdgeInfo: quadricHF is not valid") ;
Utils::QuadricHF<REAL> quadHF = m_quadricHF[d] ;
//std::cout << quadGeom(newPos) / (alpha/M_PI + quadHF(newHF)) << std::endl ;
// sum of QEM metric and frame orientation difference
const REAL& err =
quadGeom(newPos) + // geom
(
alpha
/
M_PI
)
*
avgColDiff
.
norm
()
+
// average color times covering area
(alpha / M_PI) * avgColDiff.norm
2() / 3.
+ // average color times covering area
//alpha / M_PI + // frame
quadHF(newHF) // function coefficients
;
...
...
@@ -1331,6 +1329,460 @@ void HalfEdgeSelector_LightfieldExp<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeIn
}
}
/************************************************************************************
* HALF EDGE LIGHTFIELD SELECTOR (using QEMml half-edge) KCL-like *
************************************************************************************/
template <typename PFP>
bool HalfEdgeSelector_LightfieldKCL<PFP>::init()
{
MAP& m = this->m_map ;
// Verify availability of required approximators
unsigned int ok = 0 ;
unsigned int k = 0 ;
for (unsigned int approxindex = 0 ; approxindex < this->m_approximators.size() ; ++approxindex)
{
if (this->m_approximators[approxindex]->getType() != A_hHalfCollapse)
{
std::cerr << "Approximator for selector (HalfEdgeSelector_LightfieldKCL) must be of A_hHalfCollapse" << std::endl ;
return false ;
}
assert(this->m_approximators[approxindex]->getType() == A_hHalfCollapse
|| !"Approximator for selector (HalfEdgeSelector_Lightfield) must be of A_hHalfCollapse") ;
bool saved = false ;
for (unsigned int attrindex = 0 ; attrindex < this->m_approximators[approxindex]->getNbApproximated() ; ++ attrindex)
{
// constraint : 2 approximators in specific order
if(ok == 0 && this->m_approximators[approxindex]->getApproximatedAttributeName(attrindex) == "position")
{
++ok ;
m_approxindex_pos = approxindex ;
m_attrindex_pos = attrindex ;
if (!saved)
{
m_approx.push_back(reinterpret_cast<Approximator<PFP, VEC3, DART>* >(this->m_approximators[approxindex])) ;
saved = true ;
}
}
else if(ok == 1 && this->m_approximators[approxindex]->getApproximatedAttributeName(attrindex) == "frameT")
{
++ok ;
m_approxindex_FT = approxindex ;
m_attrindex_FT = attrindex ;
if (!saved)
{
m_approx.push_back(reinterpret_cast<Approximator<PFP, VEC3, DART>* >(this->m_approximators[approxindex])) ;
assert(this->m_approx[approxindex]->getAttr(attrindex).isValid() || !"HalfEdgeSelector_LightfieldExp: frameT attribute is not valid") ;
saved = true ;
}
}
else if(ok == 2 && this->m_approximators[approxindex]->getApproximatedAttributeName(attrindex) == "frameB")
{
++ok ;
m_approxindex_FB = approxindex ;
m_attrindex_FB = attrindex ;
assert(this->m_approx[approxindex]->getAttr(attrindex).isValid() || !"HalfEdgeSelector_LightfieldExp: frameB attribute is not valid") ;
if (!saved)
{
m_approx.push_back(reinterpret_cast<Approximator<PFP, VEC3, DART>* >(this->m_approximators[approxindex])) ;
saved = true ;
}
}
else if(ok == 3 && this->m_approximators[approxindex]->getApproximatedAttributeName(attrindex) == "frameN")
{
++ok ;
m_approxindex_FN = approxindex ;
m_attrindex_FN = attrindex ;
assert(this->m_approx[approxindex]->getAttr(attrindex).isValid() || !"HalfEdgeSelector_LightfieldExp: frameN attribute is not valid") ;
if (!saved)
{
m_approx.push_back(reinterpret_cast<Approximator<PFP, VEC3, DART>* >(this->m_approximators[approxindex])) ;
saved = true ;
}
}
else
{
std::stringstream s ;