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
Etienne Schmitt
CGoGN
Commits
e00046db
Commit
e00046db
authored
Sep 11, 2012
by
Basile Sauvage
Browse files
deuxieme algo voronoi centroidaux
parent
7acfd5c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/Algo/Geometry/voronoiDiagrams.hpp
View file @
e00046db
...
...
@@ -219,7 +219,6 @@ void CentroidalVoronoiDiagram<PFP>::cumulateEnergyOnPaths(){
template
<
typename
PFP
>
unsigned
int
CentroidalVoronoiDiagram
<
PFP
>::
moveSeeds
(){
// TODO : je pense qu'il y a un bug : ça devrait convergerger bien mieux en n'utilisant que l'energie globale comme critere d'arret
unsigned
int
m
=
0
;
globalEnergy
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
seeds
.
size
();
i
++
)
...
...
@@ -231,6 +230,30 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeeds(){
return
m
;
}
template
<
typename
PFP
>
unsigned
int
CentroidalVoronoiDiagram
<
PFP
>::
moveSeeds2
(){
unsigned
int
m
=
0
;
globalEnergy
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
seeds
.
size
();
i
++
)
{
Dart
oldSeed
=
this
->
seeds
[
i
];
int
r
=
moveSeed
(
i
);
Dart
newSeed
=
this
->
seeds
[
i
];
globalEnergy
+=
distances
[
oldSeed
];
REAL
regionEnergy
=
distances
[
oldSeed
];
if
(
r
==
1
)
{
this
->
computeDistancesWithinRegion
(
newSeed
);
cumulateEnergyFromRoot
(
newSeed
);
if
(
distances
[
newSeed
]
<
regionEnergy
)
m
+=
1
;
else
this
->
seeds
[
i
]
=
oldSeed
;
}
}
return
m
;
}
template
<
typename
PFP
>
typename
PFP
::
REAL
CentroidalVoronoiDiagram
<
PFP
>::
cumulateEnergyFromRoot
(
Dart
e
){
REAL
distArea
=
areaElts
[
e
]
*
distances
[
e
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment