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
CGoGN
CGoGN
Commits
339e3d3d
Commit
339e3d3d
authored
Sep 10, 2012
by
Kenneth Vanhoey
Browse files
Add CPV decimation. Replace old code.
parent
2504d16e
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
include/Algo/Decimation/approximator.h
View file @
339e3d3d
...
...
@@ -39,15 +39,16 @@ namespace Decimation
enum
ApproximatorType
{
A_QEM
,
A_QEM
halfEdge
,
A_
h
QEM
,
A_MidEdge
,
A_HalfCollapse
,
A_CornerCutting
,
A_TangentPredict1
,
A_TangentPredict2
,
A_LightfieldHalf
,
A_hColor
/*A_LightfieldHalf,
A_LightfieldHalf_deprecated,
A_LightfieldFull_deprecated
A_LightfieldFull_deprecated
*/
}
;
template
<
typename
PFP
>
...
...
@@ -102,6 +103,9 @@ public:
m_detail
.
resize
(
m_attrV
.
size
())
;
m_app
.
resize
(
m_attrV
.
size
())
;
if
(
m_attrV
.
size
()
<
1
)
std
::
cerr
<<
"Approximator: no attributes provided"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
m_attrV
.
size
()
;
++
i
)
{
std
::
stringstream
aname
;
...
...
include/Algo/Decimation/
lightfield
Approximator.h
→
include/Algo/Decimation/
colorPerVertex
Approximator.h
View file @
339e3d3d
...
...
@@ -38,113 +38,102 @@ namespace Decimation
{
template
<
typename
PFP
>
class
Approximator_
FrameHalf
:
public
Approximator
<
PFP
,
typename
Geom
::
Matrix
<
3
,
3
,
typename
PFP
::
REAL
>
>
class
Approximator_
Color
:
public
Approximator
<
PFP
,
typename
PFP
::
VEC3
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
protected:
VertexAttribute
<
VEC3
>
*
m_color
;
public:
Approximator_FrameHalf
(
MAP
&
m
,
VertexAttribute
<
MATRIX33
>&
frame
,
Predictor
<
PFP
,
MATRIX33
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
MATRIX33
>
(
m
,
frame
,
pred
)
{}
~
Approximator_FrameHalf
()
Approximator_Color
(
MAP
&
m
,
std
::
vector
<
VertexAttribute
<
VEC3
>*
>&
attr
,
Predictor
<
PFP
,
VEC3
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
VEC3
>
(
m
,
attr
,
pred
)
{
m_color
=
this
->
m_attrV
[
0
]
;
assert
((
m_color
->
isValid
()
&&
m_color
->
name
()
==
"color"
)
||
!
"Approximator_Color: the approximated attribute is not valid or not named 'color'"
)
;
}
~
Approximator_Color
()
{}
ApproximatorType
getType
()
const
{
return
A_LightfieldHalf
;
}
bool
init
()
{
return
true
;
}
;
void
approximate
(
Dart
d
)
;
}
;
template
<
typename
PFP
>
class
Approximator_RGBfunctionsHalf
:
public
Approximator
<
PFP
,
typename
Geom
::
Matrix
<
3
,
6
,
typename
PFP
::
REAL
>
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
ApproximatorType
getType
()
const
{
return
A_hColor
;
}
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
bool
init
()
{
return
true
;
}
protected:
VertexAttribute
<
MATRIX33
>
m_frame
;
EdgeAttribute
<
MATRIX33
>
m_approxFrame
;
EdgeAttribute
<
QuadricRGBfunctions
<
REAL
>
>
m_quadricRGBfunctions
;
public:
Approximator_RGBfunctionsHalf
(
MAP
&
m
,
VertexAttribute
<
MATRIX36
>&
rgbfunctions
,
Predictor
<
PFP
,
MATRIX36
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
MATRIX36
>
(
m
,
rgbfunctions
,
pred
)
{
}
~
Approximator_RGBfunctionsHalf
()
{}
ApproximatorType
getType
()
const
{
return
A_LightfieldHalf
;
}
bool
init
()
;
void
approximate
(
Dart
d
)
;
}
;
/*
template <typename PFP>
class
Approximator_Frame
:
public
Approximator
<
PFP
,
typename
Geom
::
Matrix
<
3
,
3
,
typename
PFP
::
REAL
>
>
class Approximator_Frame
Half
: public Approximator<PFP, typename
PFP::VEC3
>
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
protected:
VertexAttribute
<
VEC3
>
m_position
;
EdgeAttribute
<
VEC3
>
m_approxPosition
;
public:
Approximator_Frame
(
MAP
&
m
,
VertexAttribute
<
MATRIX33
>&
frame
,
Predictor
<
PFP
,
MATRIX3
3
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
MATRIX3
3
>
(
m
,
frame
,
pred
)
Approximator_Frame
Half
(MAP& m,
std::vector<
VertexAttribute<
VEC3> >& attr
, Predictor<PFP,
VEC
3>* pred = NULL) :
Approximator<PFP,
VEC
3>(m,
attr
, pred)
{}
~
Approximator_Frame
()
~Approximator_Frame
Half
()
{}
ApproximatorType
getType
()
const
{
return
A_LightfieldFull
;
}
bool
init
()
;
ApproximatorType getType() const
{
return A_LightfieldHalf ;
}
bool init()
{
return true ;
}
void approximate(Dart d) ;
} ;
template <typename PFP>
class
Approximator_
RGBfunctions
:
public
Approximator
<
PFP
,
typename
Geom
::
Matrix
<
3
,
6
,
typename
PFP
::
REAL
>
>
class Approximator_
LightfieldCoefsHalf
: public Approximator<PFP, typename
PFP::VEC3
>
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
protected:
VertexAttribute
<
MATRIX33
>
m_frame
;
EdgeAttribute
<
MATRIX33
>
m_approxFrame
;
EdgeAttribute
<
QuadricRGBfunctions
<
REAL
>
>
m_quadricRGBfunctions
;
public:
Approximator_RGBfunctions
(
MAP
&
m
,
VertexAttribute
<
MATRIX36
>&
rgbfunctions
,
Predictor
<
PFP
,
MATRIX36
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
MATRIX36
>
(
m
,
rgbfunctions
,
pred
)
{
}
~
Approximator_RGBfunctions
()
Approximator_LightfieldCoefsHalf(MAP& m, std::vector<VertexAttribute<VEC3> >& attr, Predictor<PFP, VEC3>* pred = NULL) :
Approximator<PFP, VEC3>(m, attr, pred)
{}
ApproximatorType
getType
()
const
{
return
A_LightfieldFull
;
}
bool
init
()
;
~Approximator_LightfieldCoefsHalf()
{}
ApproximatorType getType() const
{
return A_LightfieldHalf ;
}
bool init()
{
return true ;
}
void approximate(Dart d) ;
} ;
*/
}
//namespace Decimation
}
//namespace Algo
}
//namespace CGoGN
#include
"Algo/Decimation/
lightfield
Approximator.hpp"
#include
"Algo/Decimation/
colorPerVertex
Approximator.hpp"
#endif
include/Algo/Decimation/colorPerVertexApproximator.hpp
0 → 100644
View file @
339e3d3d
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, 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 *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace
CGoGN
{
namespace
Algo
{
namespace
Decimation
{
/************************************************************************************
* COLOR METRIC *
************************************************************************************/
template
<
typename
PFP
>
void
Approximator_Color
<
PFP
>::
approximate
(
Dart
d
)
{
Dart
dd
=
this
->
m_map
.
phi1
(
d
)
;
this
->
m_approx
[
0
][
d
]
=
m_color
->
operator
[](
d
)
;
this
->
m_approx
[
0
][
d
]
+=
m_color
->
operator
[](
dd
)
;
this
->
m_approx
[
0
][
d
]
/=
2
;
}
}
//namespace Decimation
}
//namespace Algo
}
//namespace CGoGN
include/Algo/Decimation/decimation.h
View file @
339e3d3d
...
...
@@ -28,7 +28,8 @@
#include
"Algo/Decimation/edgeSelector.h"
#include
"Algo/Decimation/halfEdgeSelector.h"
#include
"Algo/Decimation/geometryApproximator.h"
#include
"Algo/Decimation/lightfieldApproximator.h"
#include
"Algo/Decimation/colorPerVertexApproximator.h"
//#include "Algo/Decimation/lightfieldApproximator_deprecated.h"
namespace
CGoGN
{
...
...
@@ -46,7 +47,8 @@ void decimate(
ApproximatorType
a
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
nbWantedVertices
,
const
FunctorSelect
&
selected
=
allDarts
const
FunctorSelect
&
selected
=
allDarts
,
void
(
*
callback_wrapper
)(
void
*
,
const
void
*
)
=
NULL
,
void
*
callback_object
=
NULL
)
;
}
//namespace Decimation
...
...
include/Algo/Decimation/decimation.hpp
View file @
339e3d3d
...
...
@@ -34,39 +34,88 @@ namespace Decimation
template
<
typename
PFP
>
void
decimate
(
typename
PFP
::
MAP
&
map
,
SelectorType
s
,
ApproximatorType
a
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
nbWantedVertices
,
const
FunctorSelect
&
selected
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
nbWantedVertices
,
const
FunctorSelect
&
selected
,
void
(
*
callback_wrapper
)(
void
*
,
const
void
*
),
void
*
callback_object
)
{
std
::
vector
<
ApproximatorGen
<
PFP
>*>
approximators
;
EdgeSelector
<
PFP
>*
selector
=
NULL
;
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
>*
>
v_pos
;
v_pos
.
push_back
(
&
position
)
;
switch
(
a
)
{
case
A_QEM
:
approximators
.
push_back
(
new
Approximator_QEM
<
PFP
>
(
map
,
pos
ition
))
;
approximators
.
push_back
(
new
Approximator_QEM
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_QEM
halfEdge
:
approximators
.
push_back
(
new
Approximator_QEMhalfEdge
<
PFP
>
(
map
,
pos
ition
))
;
case
A_
h
QEM
:
approximators
.
push_back
(
new
Approximator_QEMhalfEdge
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_MidEdge
:
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
pos
ition
))
;
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_CornerCutting
:
approximators
.
push_back
(
new
Approximator_CornerCutting
<
PFP
>
(
map
,
pos
ition
))
;
approximators
.
push_back
(
new
Approximator_CornerCutting
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_TangentPredict1
:
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
pos
ition
))
;
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_TangentPredict2
:
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
pos
ition
))
;
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
v_
pos
))
;
break
;
case
A_HalfCollapse
:
approximators
.
push_back
(
new
Approximator_HalfCollapse
<
PFP
>
(
map
,
position
))
;
approximators
.
push_back
(
new
Approximator_HalfCollapse
<
PFP
>
(
map
,
v_pos
))
;
break
;
case
A_hColor
:
// pos
approximators
.
push_back
(
new
Approximator_HalfCollapse
<
PFP
>
(
map
,
v_pos
))
;
// col
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
>*
>
v_col
;
VertexAttribute
<
typename
PFP
::
VEC3
>
colors
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"color"
)
;
v_col
.
push_back
(
&
colors
)
;
approximators
.
push_back
(
new
Approximator_Color
<
PFP
>
(
map
,
v_col
))
;
break
;
case
A_LightfieldFull
:
/*case A_LightfieldHalf:
approximators.push_back(new Approximator_HalfCollapse<PFP>(map, position)) ;
// Get all frame embeddings
std::vector<VertexAttribute<PFP::VEC3>* > vertexAttributesFrame ;
VertexAttribute<PFP::VEC3> frame0 = myMap.getAttribute<PFP::VEC3, VERTEX>("frameT") ; vertexAttributesFrame.push_back(&frame0) ;
VertexAttribute<PFP::VEC3> frame1 = myMap.getAttribute<PFP::VEC3, VERTEX>("frameB") ; vertexAttributesFrame.push_back(&frame1) ;
VertexAttribute<PFP::VEC3> frame2 = myMap.getAttribute<PFP::VEC3, VERTEX>("frameN") ; vertexAttributesFrame.push_back(&frame2) ;
approximators.push_back(new Approximator_FrameHalf<PFP>(map, vertexAttributesFrame)) ; // TODO
// Get all coefficient embeddings
const unsigned int K = 200 ;
std::vector<VertexAttribute<PFP::VEC3>* > vertexAttributesCoefs ;
VertexAttribute<PFP::VEC3> *PBcoefs = new VertexAttribute<PFP::VEC3>[K] ;
for (unsigned int k = 0 ; k < K ; ++k)
{
std::stringstream s ;
s << "PBcoefs" << k ;
PBcoefs[k] = myMap.getAttribute<PFP::VEC3, VERTEX>(s.str()) ;
if (!PBcoefs[k].isValid())
break ;
vertexAttributesCoefs.push_back(&PBcoefs[k]) ;
}
const bool& sh = vertexAttributesCoefs.empty() ; // sh or pb
VertexAttribute<PFP::VEC3> *SHcoefs = new VertexAttribute<PFP::VEC3>[K] ;
for (unsigned int k = 0 ; k < K ; ++k)
{
std::stringstream s ;
s << "SHcoefs" << k ;
SHcoefs[k] = myMap.getAttribute<PFP::VEC3, VERTEX>(s.str()) ;
if (!SHcoefs[k].isValid())
break ;
vertexAttributesCoefs.push_back(&SHcoefs[k]) ;
}
approximators.push_back(new Approximator_LightfieldCoefsHalf<PFP>(map, vertexAttributesCoefs, sh)) ; // TODO
break ;
case A_LightfieldFull_deprecated :
{
approximators.push_back(new Approximator_QEMhalfEdge<PFP>(map, position)) ;
/*
/
*
PFP::TVEC3 frame[3] ;
frame[0] = map.template getAttribute<typename PFP::VEC3, VERTEX>("frame_T") ; // Tangent
frame[1] = map.template getAttribute<typename PFP::VEC3, VERTEX>("frame_B") ; // Bitangent
...
...
@@ -87,22 +136,22 @@ void decimate(
if (!colorPTM[i].isValid()) {
CGoGNerr << "In function decimate : colorPTM[" << i << "] is not valid" << CGoGNendl ;
}
*
/
*
VertexAttribute<Geom::Matrix<3,3,typename PFP::REAL> > frame = map.template getAttribute<Geom::Matrix<3,3,typename PFP::REAL>, VERTEX>("frame") ;
VertexAttribute<Geom::Matrix<3,6,typename PFP::REAL> > RGBfunctions = map.template getAttribute<Geom::Matrix<3,6,typename PFP::REAL>, VERTEX>("colorPTM") ;
approximators
.
push_back
(
new
Approximator_Frame
<
PFP
>
(
map
,
frame
))
;
approximators
.
push_back
(
new
Approximator_RGBfunctions
<
PFP
>
(
map
,
RGBfunctions
))
;
approximators.push_back(new Approximator_Frame
_deprecated
<PFP>(map, frame)) ;
approximators.push_back(new Approximator_RGBfunctions
_deprecated
<PFP>(map, RGBfunctions)) ;
break ;
}
case
A_LightfieldHalf
:
case A_LightfieldHalf
_deprecated
:
{
approximators.push_back(new Approximator_HalfCollapse<PFP>(map, position)) ;
VertexAttribute<Geom::Matrix<3,3,typename PFP::REAL> > frame = map.template getAttribute<Geom::Matrix<3,3,typename PFP::REAL>, VERTEX>("frame") ;
VertexAttribute<Geom::Matrix<3,6,typename PFP::REAL> > RGBfunctions = map.template getAttribute<Geom::Matrix<3,6,typename PFP::REAL>, VERTEX>("colorPTM") ;
approximators
.
push_back
(
new
Approximator_FrameHalf
<
PFP
>
(
map
,
frame
))
;
approximators
.
push_back
(
new
Approximator_RGBfunctionsHalf
<
PFP
>
(
map
,
RGBfunctions
))
;
approximators.push_back(new Approximator_FrameHalf
_deprecated
<PFP>(map, frame)) ;
approximators.push_back(new Approximator_RGBfunctionsHalf
_deprecated
<PFP>(map, RGBfunctions)) ;
break ;
}
}
*/
}
switch
(
s
)
...
...
@@ -128,12 +177,15 @@ void decimate(
case
S_MinDetail
:
selector
=
new
EdgeSelector_MinDetail
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_hLightfield
:
selector
=
new
HalfEdgeSelector_Lightfield
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
/*
case S_hLightfield
_deprecated
:
selector = new HalfEdgeSelector_Lightfield
_deprecated
<PFP>(map, position, approximators, selected) ;
break ;
*/
case
S_hQEMml
:
selector
=
new
HalfEdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_hColor
:
selector
=
new
HalfEdgeSelector_Color
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
}
for
(
typename
std
::
vector
<
ApproximatorGen
<
PFP
>*>::
iterator
it
=
approximators
.
begin
();
it
!=
approximators
.
end
();
++
it
)
...
...
@@ -148,11 +200,8 @@ void decimate(
while
(
!
finished
)
{
// CGoGNout << "Countdown : " ;
// CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << CGoGNflush ;
if
(
!
selector
->
nextEdge
(
d
))
{
// CGoGNout << CGoGNendl << "out" << CGoGNendl ;
if
(
!
selector
->
nextEdge
(
d
))
{
break
;
}
...
...
@@ -176,10 +225,14 @@ void decimate(
selector
->
updateAfterCollapse
(
d2
,
dd2
)
;
// update selector
if
(
nbVertices
<=
nbWantedVertices
)
{
if
(
nbVertices
<=
nbWantedVertices
)
{
finished
=
true
;
// CGoGNout << CGoGNendl << "done" << CGoGNendl ;
}
// Progress bar support
if
(
callback_wrapper
!=
NULL
&&
callback_object
!=
NULL
)
callback_wrapper
(
callback_object
,
&
nbVertices
)
;
}
delete
selector
;
...
...
include/Algo/Decimation/edgeSelector.hpp
View file @
339e3d3d
...
...
@@ -475,6 +475,8 @@ void EdgeSelector_QEM<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
REAL
err
=
std
::
max
(
REAL
(
0
),
REAL
(
quad
(
m_positionApproximator
->
getApprox
(
d
))))
;
std
::
cout
<<
quad
(
m_positionApproximator
->
getApprox
(
d
))
<<
std
::
endl
;
einfo
.
it
=
edges
.
insert
(
std
::
make_pair
(
err
,
d
))
;
einfo
.
valid
=
true
;
}
...
...
@@ -1074,7 +1076,7 @@ void EdgeSelector_MinDetail<PFP>::updateEdgeInfo(Dart d, bool recompute)
template
<
typename
PFP
>
void
EdgeSelector_MinDetail
<
PFP
>::
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
{
Dart
dd
=
this
->
m_map
.
phi2
(
d
)
;
//
Dart dd = this->m_map.phi2(d) ;
REAL
err
=
REAL
(
0
)
;
// for(typename std::vector<ApproximatorGen<PFP>*>::iterator it = this->m_approximators.begin();
...
...
include/Algo/Decimation/geometryApproximator.h
View file @
339e3d3d
...
...
@@ -79,7 +79,7 @@ public:
}
~
Approximator_QEMhalfEdge
()
{}
ApproximatorType
getType
()
const
{
return
A_QEM
halfEdge
;
}
ApproximatorType
getType
()
const
{
return
A_
h
QEM
;
}
bool
init
()
;
void
approximate
(
Dart
d
)
;
}
;
...
...
include/Algo/Decimation/halfEdgeSelector.h
View file @
339e3d3d
...
...
@@ -86,7 +86,61 @@ public:
}
;
template
<
typename
PFP
>
class
HalfEdgeSelector_Lightfield
:
public
EdgeSelector
<
PFP
>
class
HalfEdgeSelector_Color
:
public
EdgeSelector
<
PFP
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
private:
typedef
struct
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
static
std
::
string
CGoGNnameOfType
()
{
return
"ColorHalfEdgeInfo"
;
}
}
QEMhalfEdgeInfo
;
typedef
NoMathIOAttribute
<
QEMhalfEdgeInfo
>
HalfEdgeInfo
;
DartAttribute
<
HalfEdgeInfo
>
halfEdgeInfo
;
VertexAttribute
<
VEC3
>
m_color
;
VertexAttribute
<
Quadric
<
REAL
>
>
m_quadric
;
std
::
multimap
<
float
,
Dart
>
halfEdges
;
typename
std
::
multimap
<
float
,
Dart
>::
iterator
cur
;
Approximator
<
PFP
,
typename
PFP
::
VEC3
>*
m_positionApproximator
;
Approximator
<
PFP
,
typename
PFP
::
VEC3
>*
m_colorApproximator
;
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
)
;
public:
HalfEdgeSelector_Color
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
allDarts
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
halfEdgeInfo
=
m
.
template
addAttribute
<
HalfEdgeInfo
,
DART
>(
"halfEdgeInfo"
)
;
m_quadric
=
m
.
template
addAttribute
<
Quadric
<
REAL
>,
VERTEX
>
(
"QEMquadric"
)
;
m_color
=
m
.
template
getAttribute
<
VEC3
,
VERTEX
>(
"color"
)
;
assert
(
m_color
.
isValid
()
||
!
"HalfEdgeSelector_Color: Color atrribute to select is not valid"
)
;
}
~
HalfEdgeSelector_Color
()
{
this
->
m_map
.
removeAttribute
(
halfEdgeInfo
)
;
this
->
m_map
.
removeAttribute
(
m_quadric
)
;
}
SelectorType
getType
()
{
return
S_hColor
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
}
;
/*template <typename PFP>
class HalfEdgeSelector_Lightfield_deprecated : public EdgeSelector<PFP>
{
public:
typedef typename PFP::MAP MAP ;
...
...
@@ -101,7 +155,7 @@ private:
{
typename std::multimap<float,Dart>::iterator it ;
bool valid ;
static
std
::
string
CGoGNnameOfType
()
{
return
"LightfieldHalfEdgeInfo"
;
}
static std::string CGoGNnameOfType() { return "LightfieldHalfEdgeInfo
_deprecated
" ; }
} LightfieldHalfEdgeInfo ;
typedef NoMathIOAttribute<LightfieldHalfEdgeInfo> HalfEdgeInfo ;
...
...
@@ -124,7 +178,7 @@ private:
void recomputeQuadric(const Dart d, const bool recomputeNeighbors) ;
public:
HalfEdgeSelector_Lightfield
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
allDarts
)
:
HalfEdgeSelector_Lightfield
_deprecated
(MAP& m, VertexAttribute<typename PFP::VEC3>& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = allDarts) :
EdgeSelector<PFP>(m, pos, approx, select)
{
m_frame = m.template getAttribute<MATRIX33, VERTEX>("frame") ;
...
...
@@ -133,20 +187,20 @@ public:
quadric = m.template addAttribute<Quadric<REAL>, VERTEX>("QEMquadric") ;
quadricRGBfunctions = m.template addAttribute<QuadricRGBfunctions<REAL>, EDGE>("quadricRGBfunctions") ;
}
~
HalfEdgeSelector_Lightfield
()
~HalfEdgeSelector_Lightfield
_deprecated
()
{
this->m_map.removeAttribute(quadric) ;
this->m_map.removeAttribute(quadricRGBfunctions) ;
this->m_map.removeAttribute(halfEdgeInfo) ;
}
SelectorType
getType
()
{
return
S_hLightfield
;
}
SelectorType getType() { return S_hLightfield
_deprecated
; }
bool init() ;
bool nextEdge(Dart& d) ;
void updateBeforeCollapse(Dart d) ;
void updateAfterCollapse(Dart d2, Dart dd2) ;
} ;
/*
/
*
template <typename PFP>
class EdgeSelector_Lightfield : public EdgeSelector<PFP>
{
...
...
include/Algo/Decimation/halfEdgeSelector.hpp
View file @
339e3d3d
This diff is collapsed.
Click to expand it.
include/Algo/Decimation/lightfieldApproximator.hpp
deleted
100644 → 0
View file @
2504d16e
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, 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 *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *