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
7acfd5c2
Commit
7acfd5c2
authored
Sep 11, 2012
by
Basile Sauvage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction bug voronoi centroidaux
parent
5b4f36f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
include/Algo/Geometry/voronoiDiagrams.h
include/Algo/Geometry/voronoiDiagrams.h
+2
-0
include/Algo/Geometry/voronoiDiagrams.hpp
include/Algo/Geometry/voronoiDiagrams.hpp
+40
-3
No files found.
include/Algo/Geometry/voronoiDiagrams.h
View file @
7acfd5c2
...
@@ -51,6 +51,7 @@ public :
...
@@ -51,6 +51,7 @@ public :
void
setCost
(
const
EdgeAttribute
<
REAL
>&
c
);
void
setCost
(
const
EdgeAttribute
<
REAL
>&
c
);
void
computeDiagram
();
void
computeDiagram
();
void
computeDistancesWithinRegion
(
Dart
seed
);
protected
:
protected
:
virtual
void
clear
();
virtual
void
clear
();
...
@@ -84,6 +85,7 @@ public :
...
@@ -84,6 +85,7 @@ public :
void
cumulateEnergyOnPaths
();
void
cumulateEnergyOnPaths
();
unsigned
int
moveSeeds
();
// returns the number of seeds that did move
unsigned
int
moveSeeds
();
// returns the number of seeds that did move
unsigned
int
moveSeeds2
();
// returns the number of seeds that did move
REAL
getGlobalEnergy
()
{
return
globalEnergy
;}
REAL
getGlobalEnergy
()
{
return
globalEnergy
;}
protected
:
protected
:
...
...
include/Algo/Geometry/voronoiDiagrams.hpp
View file @
7acfd5c2
...
@@ -26,7 +26,6 @@ VoronoiDiagram<PFP>::~VoronoiDiagram ()
...
@@ -26,7 +26,6 @@ VoronoiDiagram<PFP>::~VoronoiDiagram ()
template
<
typename
PFP
>
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
clear
()
void
VoronoiDiagram
<
PFP
>::
clear
()
{
{
border
.
clear
();
regions
.
setAllValues
(
0
);
regions
.
setAllValues
(
0
);
border
.
clear
();
border
.
clear
();
front
.
clear
();
front
.
clear
();
...
@@ -141,6 +140,41 @@ void VoronoiDiagram<PFP>::computeDiagram ()
...
@@ -141,6 +140,41 @@ void VoronoiDiagram<PFP>::computeDiagram ()
}
}
}
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
computeDistancesWithinRegion
(
Dart
seed
)
{
// TODO : this algo has not yet been tested
// init
front
.
clear
();
vmReached
.
unmarkAll
();
vmReached
.
mark
(
seed
);
vertexInfo
[
seed
].
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
0.0
,
seed
));
vertexInfo
[
seed
].
valid
=
true
;
vertexInfo
[
seed
].
pathOrigin
=
seed
;
//compute
while
(
!
front
.
empty
()
)
{
Dart
e
=
front
.
begin
()
->
second
;
float
d
=
front
.
begin
()
->
first
;
collectVertexFromFront
(
e
);
Traversor2VVaE
<
typename
PFP
::
MAP
>
tv
(
map
,
e
);
for
(
Dart
f
=
tv
.
begin
();
f
!=
tv
.
end
();
f
=
tv
.
next
())
{
if
(
vmReached
.
isMarked
(
f
))
{
// f has been reached
if
(
vertexInfo
[
f
].
valid
)
updateVertexInFront
(
f
,
d
);
// f is in the front : update
}
else
{
// f has not been reached : add it to the front
if
(
regions
[
f
]
==
regions
[
e
]
)
addVertexToFront
(
f
,
d
);
}
}
}
}
/***********************************************************
/***********************************************************
* class CentroidalVoronoiDiagram
* class CentroidalVoronoiDiagram
***********************************************************/
***********************************************************/
...
@@ -171,6 +205,8 @@ void CentroidalVoronoiDiagram<PFP>::collectVertexFromFront(Dart e){
...
@@ -171,6 +205,8 @@ void CentroidalVoronoiDiagram<PFP>::collectVertexFromFront(Dart e){
VoronoiDiagram
<
PFP
>::
collectVertexFromFront
(
e
);
VoronoiDiagram
<
PFP
>::
collectVertexFromFront
(
e
);
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
void
CentroidalVoronoiDiagram
<
PFP
>::
cumulateEnergyOnPaths
(){
void
CentroidalVoronoiDiagram
<
PFP
>::
cumulateEnergyOnPaths
(){
globalEnergy
=
0.0
;
globalEnergy
=
0.0
;
...
@@ -183,17 +219,18 @@ void CentroidalVoronoiDiagram<PFP>::cumulateEnergyOnPaths(){
...
@@ -183,17 +219,18 @@ void CentroidalVoronoiDiagram<PFP>::cumulateEnergyOnPaths(){
template
<
typename
PFP
>
template
<
typename
PFP
>
unsigned
int
CentroidalVoronoiDiagram
<
PFP
>::
moveSeeds
(){
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
;
unsigned
int
m
=
0
;
globalEnergy
=
0.0
;
globalEnergy
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
seeds
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
seeds
.
size
();
i
++
)
{
{
Dart
oldSeed
=
this
->
seeds
[
i
];
m
+=
moveSeed
(
i
);
m
+=
moveSeed
(
i
);
globalEnergy
+=
distances
[
this
->
seeds
[
i
]
];
globalEnergy
+=
distances
[
oldSeed
];
}
}
return
m
;
return
m
;
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
CentroidalVoronoiDiagram
<
PFP
>::
cumulateEnergyFromRoot
(
Dart
e
){
typename
PFP
::
REAL
CentroidalVoronoiDiagram
<
PFP
>::
cumulateEnergyFromRoot
(
Dart
e
){
REAL
distArea
=
areaElts
[
e
]
*
distances
[
e
];
REAL
distArea
=
areaElts
[
e
]
*
distances
[
e
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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