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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
ea93f7ca
Commit
ea93f7ca
authored
Oct 26, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding catmull-clark and sqrt(3) lazy wavelets
parent
d25284ab
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1874 additions
and
617 deletions
+1874
-617
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+3
-0
include/Algo/Decimation/edgeSelector.h
include/Algo/Decimation/edgeSelector.h
+5
-5
include/Algo/Decimation/edgeSelector.hpp
include/Algo/Decimation/edgeSelector.hpp
+72
-12
include/Algo/DecimationVolumes/approximator.h
include/Algo/DecimationVolumes/approximator.h
+11
-37
include/Algo/DecimationVolumes/decimator.hpp
include/Algo/DecimationVolumes/decimator.hpp
+25
-26
include/Algo/DecimationVolumes/edgeSelector.h
include/Algo/DecimationVolumes/edgeSelector.h
+131
-46
include/Algo/DecimationVolumes/edgeSelector.hpp
include/Algo/DecimationVolumes/edgeSelector.hpp
+133
-118
include/Algo/DecimationVolumes/geometryApproximator.h
include/Algo/DecimationVolumes/geometryApproximator.h
+5
-10
include/Algo/DecimationVolumes/geometryApproximator.hpp
include/Algo/DecimationVolumes/geometryApproximator.hpp
+10
-61
include/Algo/DecimationVolumes/selector.h
include/Algo/DecimationVolumes/selector.h
+9
-56
include/Algo/Multiresolution/Map2MR/Filters/catmullClark.h
include/Algo/Multiresolution/Map2MR/Filters/catmullClark.h
+455
-0
include/Algo/Multiresolution/Map2MR/Filters/sqrt2.h
include/Algo/Multiresolution/Map2MR/Filters/sqrt2.h
+97
-0
include/Algo/Multiresolution/Map2MR/Filters/sqrt3.h
include/Algo/Multiresolution/Map2MR/Filters/sqrt3.h
+324
-0
include/Algo/Multiresolution/Map2MR/Masks/sqrt3.h
include/Algo/Multiresolution/Map2MR/Masks/sqrt3.h
+130
-0
include/Algo/Multiresolution/Map2MR/lerpAttributes.h
include/Algo/Multiresolution/Map2MR/lerpAttributes.h
+245
-0
include/Algo/Multiresolution/Map2MR/map2MR_PM.h
include/Algo/Multiresolution/Map2MR/map2MR_PM.h
+22
-1
include/Algo/Multiresolution/Map2MR/map2MR_PM.hpp
include/Algo/Multiresolution/Map2MR/map2MR_PM.hpp
+41
-59
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.h
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.h
+3
-4
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.hpp
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.hpp
+61
-17
include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp
include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp
+16
-0
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+27
-0
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+5
-4
include/Topology/map/map2.h
include/Topology/map/map2.h
+6
-15
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+20
-46
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+12
-16
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+6
-84
No files found.
Apps/Tuto/tuto_oper3.cpp
View file @
ea93f7ca
...
...
@@ -650,11 +650,14 @@ void MyQT::importMesh(std::string& filename)
else
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
}
m_selected
=
NIL
;
m_selected2
=
NIL
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_ex1
,
m_ex2
,
m_ex3
,
nb
);
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
setParamObject
(
bb
.
maxSize
(),
bb
.
center
().
data
())
;
m_shift
=
bb
.
maxSize
()
/
200.0
f
;
...
...
include/Algo/Decimation/edgeSelector.h
View file @
ea93f7ca
...
...
@@ -97,7 +97,7 @@ public:
{}
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
void
updateWithoutCollapse
()
;
}
;
template
<
typename
PFP
>
...
...
@@ -142,7 +142,7 @@ public:
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
void
updateWithoutCollapse
()
;
}
;
template
<
typename
PFP
>
...
...
@@ -246,7 +246,7 @@ public:
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
void
updateWithoutCollapse
()
;
}
;
template
<
typename
PFP
>
...
...
@@ -344,7 +344,7 @@ public:
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
void
updateWithoutCollapse
()
;
}
;
template
<
typename
PFP
>
...
...
@@ -392,7 +392,7 @@ public:
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
void
updateWithoutCollapse
()
;
}
;
/*****************************************************************************************************************
...
...
include/Algo/Decimation/edgeSelector.hpp
View file @
ea93f7ca
...
...
@@ -69,6 +69,7 @@ void EdgeSelector_MapOrder<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
}
}
/************************************************************************************
* RANDOM *
************************************************************************************/
...
...
@@ -126,6 +127,22 @@ void EdgeSelector_Random<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
} while(!this->m_select(cur) || !m.edgeCanCollapse(darts[cur])) ;
}
template <typename PFP>
void EdgeSelector_Random<PFP>::updateWithoutCollapse()
{
MAP& m = this->m_map ;
allSkipped = false ;
do
{
++cur ;
if(cur == darts.size())
{
cur = 0 ;
allSkipped = true ;
}
} while(!this->m_select(cur) || !m.edgeCanCollapse(darts[cur])) ;
}
/************************************************************************************
* EDGE LENGTH *
************************************************************************************/
...
...
@@ -222,6 +239,17 @@ void EdgeSelector_Length<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
cur = edges.begin() ; // set the current edge to the first one
}
template <typename PFP>
void EdgeSelector_Length<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
template <typename PFP>
void EdgeSelector_Length<PFP>::initEdgeInfo(Dart d)
{
...
...
@@ -417,6 +445,17 @@ void EdgeSelector_QEM<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
cur = edges.begin() ; // set the current edge to the first one
}
template <typename PFP>
void EdgeSelector_QEM<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
template <typename PFP>
void EdgeSelector_QEM<PFP>::initEdgeInfo(Dart d)
{
...
...
@@ -479,18 +518,6 @@ void EdgeSelector_QEM<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
einfo.valid = true ;
}
template <typename PFP>
void EdgeSelector_QEM<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
/************************************************************************************
* QUADRIC ERROR METRIC (Memoryless version) *
************************************************************************************/
...
...
@@ -660,6 +687,17 @@ void EdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
cur = edges.begin() ; // set the current edge to the first one
}
template <typename PFP>
void EdgeSelector_QEMml<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
template <typename PFP>
void EdgeSelector_QEMml<PFP>::initEdgeInfo(Dart d)
{
...
...
@@ -839,6 +877,17 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
cur = edges.begin() ; // set the current edge to the first one
}
template <typename PFP>
void EdgeSelector_Curvature<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
template <typename PFP>
void EdgeSelector_Curvature<PFP>::initEdgeInfo(Dart d)
{
...
...
@@ -1039,6 +1088,17 @@ void EdgeSelector_MinDetail<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
cur = edges.begin() ; // set the current edge to the first one
}
template <typename PFP>
void EdgeSelector_MinDetail<PFP>::updateWithoutCollapse()
{
EdgeInfo& einfo = edgeInfo[(*cur).second] ;
einfo.valid = false ;
edges.erase(einfo.it) ;
//edges.erase(cur) ;
cur = edges.begin();
}
template <typename PFP>
void EdgeSelector_MinDetail<PFP>::initEdgeInfo(Dart d)
{
...
...
include/Algo/DecimationVolumes/approximator.h
View file @
ea93f7ca
...
...
@@ -39,7 +39,8 @@ namespace DecimationVolumes
enum
ApproximatorType
{
A_QEM
A_QEM
,
A_MidEdge
};
template
<
typename
PFP
>
...
...
@@ -61,12 +62,10 @@ public:
virtual
const
std
::
string
&
getApproximatedAttributeName
()
const
=
0
;
virtual
ApproximatorType
getType
()
const
=
0
;
virtual
bool
init
()
=
0
;
virtual
void
approximate
(
Dart
d
)
=
0
;
virtual
void
saveApprox
(
Dart
d
)
=
0
;
virtual
void
affectApprox
(
Dart
d
)
=
0
;
virtual
const
PredictorGen
<
PFP
>*
getPredictor
()
const
=
0
;
virtual
void
approximate
(
Operator
<
PFP
>*
op
)
=
0
;
virtual
void
saveApprox
(
Operator
<
PFP
>*
op
)
=
0
;
virtual
void
affectApprox
(
Operator
<
PFP
>*
op
)
=
0
;
virtual
void
approximate
(
Dart
d
)
=
0
;
}
;
...
...
@@ -123,46 +122,21 @@ public:
return
m_approx
[
d
]
;
}
const
Predictor
<
PFP
,
T
>*
getPredictor
()
const
void
saveApprox
(
Dart
d
)
{
return
m_predictor
;
m_app
=
m_approx
[
d
]
;
}
const
T
&
getDetail
(
Dart
d
)
const
void
affectApprox
(
Dart
d
)
{
assert
(
m_predictor
||
!
"Trying to get detail on a non-predictive scheme"
)
;
return
m_detail
[
d
]
;
m_attrV
[
d
]
=
m_app
;
}
void
setDetail
(
Dart
d
,
T
&
val
)
{
assert
(
m_predictor
||
!
"Trying to set detail on a non-predictive scheme"
)
;
m_detail
[
d
]
=
val
;
}
virtual
void
saveApprox
(
Operator
<
PFP
>*
op
)
{
Dart
d
=
op
->
getEdge
();
m_app
=
m_approx
[
d
];
}
virtual
void
affectApprox
(
Operator
<
PFP
>*
op
)
const
Predictor
<
PFP
,
T
>*
getPredictor
()
const
{
Dart
d
=
op
->
getEdge
();
m_attrV
[
d
]
=
m_app
;
return
m_predictor
;
}
// void saveApprox(Dart d)
// {
// m_app = m_approx[d] ;
// }
//
// void affectApprox(Dart d)
// {
// m_attrV[d] = m_app ;
// }
};
...
...
include/Algo/DecimationVolumes/decimator.hpp
View file @
ea93f7ca
...
...
@@ -38,13 +38,13 @@ void decimate(
)
{
std
::
vector
<
ApproximatorGen
<
PFP
>*>
approximators
;
Edge
Selector
<
PFP
>*
selector
=
NULL
;
Selector
<
PFP
>*
selector
=
NULL
;
//choose the Approximator
switch
(
a
)
{
case
A_
QEM
:
approximators
.
push_back
(
new
Approximator_
QEM
<
PFP
>
(
map
,
position
))
;
case
A_
MidEdge
:
approximators
.
push_back
(
new
Approximator_
MidEdge
<
PFP
>
(
map
,
position
))
;
break
;
default
:
CGoGNout
<<
"not yet implemented"
<<
CGoGNendl
;
...
...
@@ -54,8 +54,11 @@ void decimate(
//choose the Selector
switch
(
s
)
{
case
S_QEM
:
selector
=
new
EdgeSelector_QEM
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
case
S_MapOrder
:
selector
=
new
Algo
::
DecimationVolumes
::
EdgeSelector_MapOrder
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_Random
:
selector
=
new
Algo
::
DecimationVolumes
::
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
default:
CGoGNout
<<
"not yet implemented"
<<
CGoGNendl
;
...
...
@@ -78,42 +81,38 @@ void decimate(
while
(
!
finished
)
{
//Next Operator to perform
Operator
<
PFP
>
*
op
;
if
(
!
selector
->
nextEdge
(
d
))
break
;
if
((
op
=
selector
->
nextOperator
())
==
NULL
)
break
;
std
::
cout
<<
"d = "
<<
d
<<
std
::
endl
;
--
nbVertices
;
Dart
d2
=
map
.
phi2
(
map
.
phi_1
(
d
))
;
Dart
dd2
=
map
.
phi2
(
map
.
phi_1
(
map
.
phi2
(
d
)))
;
// compute approximated attributes
for
(
typename
std
::
vector
<
ApproximatorGen
<
PFP
>*>::
iterator
it
=
approximators
.
begin
();
it
!=
approximators
.
end
();
++
it
)
{
(
*
it
)
->
approximate
(
op
)
;
(
*
it
)
->
saveApprox
(
op
)
;
(
*
it
)
->
approximate
(
d
)
;
// compute approximated attributes
(
*
it
)
->
saveApprox
(
d
)
;
}
//Update the selector before performing operation
if
(
!
selector
->
updateBeforeOperation
(
op
))
break
;
selector
->
updateBeforeCollapse
(
d
)
;
// update selector
map
.
collapseEdge
(
d
)
;
// collapse edge
//Perform the topological operation and
//compute the number of resulting cells
nbVertices
-=
op
->
collapse
(
map
,
position
);
if
(
!
map
.
check
())
finished
=
true
;
for
(
typename
std
::
vector
<
ApproximatorGen
<
PFP
>*>::
iterator
it
=
approximators
.
begin
();
it
!=
approximators
.
end
();
++
it
)
(
*
it
)
->
affectApprox
(
op
);
// affect data to the resulting vertex
(
*
it
)
->
affectApprox
(
d2
);
// affect data to the resulting vertex
//Update the embedded position and
//search the next operation to perform
selector
->
updateAfterOperation
(
op
);
selector
->
updateAfterCollapse
(
d2
,
dd2
)
;
// update selector
if
(
nbVertices
<=
nbWantedVertices
)
finished
=
true
;
delete
op
;
}
selector
->
finish
()
;
CGoGNout
<<
"..done ("
<<
nbVertices
<<
" vertices)"
<<
CGoGNendl
;
delete
selector
;
...
...
include/Algo/DecimationVolumes/edgeSelector.h
View file @
ea93f7ca
...
...
@@ -3,7 +3,6 @@
#include "Container/fakeAttribute.h"
#include "Algo/DecimationVolumes/selector.h"
#include "Algo/DecimationVolumes/operator.h"
#include "Utils/qem.h"
#include "Topology/generic/traversorCell.h"
...
...
@@ -16,80 +15,166 @@ namespace Algo
namespace
DecimationVolumes
{
/*
*******************************************************************************
*
Parent Edge Selector *
*
*******************************************************************************
/
/*
*
Map Order
*/
template
<
typename
PFP
>
class
EdgeSelector
:
public
Selector
<
PFP
>
class
EdgeSelector
_MapOrder
:
public
Selector
<
PFP
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
protected:
typedef
typename
PFP
::
REAL
REAL
;
private:
Dart
cur
;
public:
EdgeSelector
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
_MapOrder
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
Selector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{}
~
EdgeSelector_MapOrder
()
{}
SelectorType
getType
()
{
return
S_MapOrder
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d
)
{}
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
}
;
};
/*
* Random
*/
template
<
typename
PFP
>
class
EdgeSelector_
QEM
:
public
Edge
Selector
<
PFP
>
class
EdgeSelector_
Random
:
public
Selector
<
PFP
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
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
"QEMedgeInfo"
;
}
}
QEMedgeInfo
;
std
::
vector
<
Dart
>
darts
;
unsigned
int
cur
;
bool
allSkipped
;
public:
EdgeSelector_Random
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
Selector
<
PFP
>
(
m
,
pos
,
approx
,
select
),
cur
(
0
),
allSkipped
(
false
)
{}
~
EdgeSelector_Random
()
{}
SelectorType
getType
()
{
return
S_Random
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d2
)
{}
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
typedef
NoMathIOAttribute
<
QEMedgeInfo
>
EdgeInfo
;
void
updateWithoutCollapse
()
{
}
}
;
EdgeAttribute
<
EdgeInfo
>
edgeInfo
;
VertexAttribute
<
Quadric
<
REAL
>
>
quadric
;
Quadric
<
REAL
>
tmpQ
;
/*
* Edge Length
*/
template
<
typename
PFP
>
class
EdgeSelector_Length
:
public
Selector
<
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
"LengthEdgeInfo"
;
}
}
LengthEdgeInfo
;
typedef
NoMathIOAttribute
<
LengthEdgeInfo
>
EdgeInfo
;
std
::
multimap
<
float
,
Dart
>
edges
;
typename
std
::
multimap
<
float
,
Dart
>::
iterator
cur
;
EdgeAttribute
<
EdgeInfo
>
edgeInfo
;
Approximator
<
PFP
,
typename
PFP
::
VEC3
>*
m_positionApproximator
;
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
initEdgeInfo
(
Dart
d
)
;
void
updateEdgeInfo
(
Dart
d
,
bool
recompute
)
;
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_QEM
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*
>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
EdgeSelector_Length
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
Selector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
>(
"edgeInfo"
);
quadric
=
m
.
template
addAttribute
<
Quadric
<
REAL
>,
VERTEX
>
(
"QEMquadric"
);
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
>(
"edgeInfo"
)
;
}
~
EdgeSelector_QEM
()
~
EdgeSelector_Length
()
{
this
->
m_map
.
removeAttribute
(
quadric
);
this
->
m_map
.
removeAttribute
(
edgeInfo
);
this
->
m_map
.
removeAttribute
(
edgeInfo
)
;
}
SelectorType
getType
()
{
return
S_EdgeLength
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d
)
;
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
}
;
/*
* Progressive Tetrahedralizations [SG98]
* Oliver Staadt && Markus Gross
*/
template
<
typename
PFP
>
class
EdgeSelector_SG98
:
public
Selector
<
PFP
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
SelectorType
getType
()
{
return
S_QEM
;
}
bool
init
();
Operator
<
PFP
>*
nextOperator
();
bool
updateBeforeOperation
(
Operator
<
PFP
>*
op
);
void
updateAfterOperation
(
Operator
<
PFP
>*
op
);
void
finish
()
{
}
};
private:
typedef
struct
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
static
std
::
string
CGoGNnameOfType
()
{
return
"SG98edgeInfo"
;
}
}
SG98edgeInfo
;
typedef
NoMathIOAttribute
<
SG98edgeInfo
>
EdgeInfo
;
EdgeAttribute
<
EdgeInfo
>
edgeInfo
;
std
::
multimap
<
float
,
Dart
>
edges
;
typename
std
::
multimap
<
float
,
Dart
>::
iterator
cur
;
Approximator
<
PFP
,
typename
PFP
::
VEC3
>*
m_positionApproximator
;
void
initEdgeInfo
(
Dart
d
)
;
void
updateEdgeInfo
(
Dart
d
,
bool
recompute
)
;
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_SG98
(
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
Selector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{}
~
EdgeSelector_SG98
()
{}
SelectorType
getType
()
{
return
S_SG98
;
}
bool
init
()
;
bool
nextEdge
(
Dart
&
d
)
;
void
updateBeforeCollapse
(
Dart
d
);
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
void
updateWithoutCollapse
()
{
}
}
;
...
...
include/Algo/DecimationVolumes/edgeSelector.hpp
View file @
ea93f7ca
...
...
@@ -33,21 +33,117 @@ namespace Algo
namespace
DecimationVolumes
{
/************************************************************************************
* MAP ORDER *
************************************************************************************/
template
<
typename
PFP
>
bool
EdgeSelector_MapOrder
<
PFP
>::
init
()
{
MAP
&
m
=
this
->
m_map
;
cur
=
m
.
begin
()
;
while
(
!
this
->
m_select
(
cur
)
||
!
m
.
edgeCanCollapse
(
cur
))
{
m
.
next
(
cur
)
;
if
(
cur
==
m
.
end
())
return
false
;
}