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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
a3d64939
Commit
a3d64939
authored
Sep 05, 2012
by
Basile Sauvage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout des diag de Voronoi centroidaux (debut)
parent
cbbaa4c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
5 deletions
+58
-5
include/Algo/Geometry/voronoiDiagrams.h
include/Algo/Geometry/voronoiDiagrams.h
+21
-3
include/Algo/Geometry/voronoiDiagrams.hpp
include/Algo/Geometry/voronoiDiagrams.hpp
+37
-2
No files found.
include/Algo/Geometry/voronoiDiagrams.h
View file @
a3d64939
...
...
@@ -17,9 +17,8 @@ namespace Geometry
template
<
typename
PFP
>
class
VoronoiDiagram
{
pr
ivate
:
pr
otected
:
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
struct
{
...
...
@@ -53,7 +52,7 @@ public :
void
computeDiagram
();
pr
ivate
:
pr
otected
:
void
clear
();
void
initFrontWithSeeds
();
void
collectVertexFromFront
(
Dart
e
);
...
...
@@ -61,6 +60,25 @@ private :
void
updateVertexInFront
(
Dart
f
,
float
d
);
};
template
<
typename
PFP
>
class
CentroidalVoronoiDiagram
:
public
VoronoiDiagram
<
PFP
>
{
private
:
typedef
typename
PFP
::
REAL
REAL
;
VertexAttribute
<
REAL
>&
distances
;
// distances from the seed
VertexAttribute
<
Dart
>&
pathOrigins
;
// previous vertex on the shortest path from origin
public
:
CentroidalVoronoiDiagram
(
typename
PFP
::
MAP
&
m
,
const
EdgeAttribute
<
REAL
>&
c
,
VertexAttribute
<
unsigned
int
>&
r
,
VertexAttribute
<
REAL
>&
d
,
VertexAttribute
<
Dart
>&
o
);
~
CentroidalVoronoiDiagram
();
protected
:
void
clear
();
void
collectVertexFromFront
(
Dart
e
);
};
}
// end namespace Geometry
}
// end namespace Algo
}
// end namespace CGoGN
...
...
include/Algo/Geometry/voronoiDiagrams.hpp
View file @
a3d64939
...
...
@@ -7,6 +7,10 @@ namespace Algo
namespace
Geometry
{
/***********************************************************
* class VoronoiDiagram
***********************************************************/
template
<
typename
PFP
>
VoronoiDiagram
<
PFP
>::
VoronoiDiagram
(
typename
PFP
::
MAP
&
m
,
const
EdgeAttribute
<
REAL
>&
p
,
VertexAttribute
<
unsigned
int
>&
r
)
:
map
(
m
),
edgeCost
(
p
),
regions
(
r
),
vmReached
(
m
)
{
...
...
@@ -79,10 +83,10 @@ void VoronoiDiagram<PFP>::setCost (const EdgeAttribute<typename PFP::REAL>& c){
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
collectVertexFromFront
(
Dart
e
){
front
.
erase
(
vertexInfo
[
e
].
it
);
vertexInfo
[
e
].
valid
=
false
;
// regions[e] = vertexInfo[e].region;
regions
[
e
]
=
regions
[
vertexInfo
[
e
].
pathOrigin
];
front
.
erase
(
vertexInfo
[
e
].
it
);
vertexInfo
[
e
].
valid
=
false
;
}
template
<
typename
PFP
>
...
...
@@ -138,6 +142,37 @@ void VoronoiDiagram<PFP>::computeDiagram ()
}
}
/***********************************************************
* class CentroidalVoronoiDiagram
***********************************************************/
template
<
typename
PFP
>
CentroidalVoronoiDiagram
<
PFP
>::
CentroidalVoronoiDiagram
(
typename
PFP
::
MAP
&
m
,
const
EdgeAttribute
<
REAL
>&
c
,
VertexAttribute
<
unsigned
int
>&
r
,
VertexAttribute
<
REAL
>&
d
,
VertexAttribute
<
Dart
>&
o
)
:
VoronoiDiagram
<
PFP
>
(
m
,
c
,
r
),
distances
(
d
),
pathOrigins
(
o
)
{
}
template
<
typename
PFP
>
CentroidalVoronoiDiagram
<
PFP
>::~
CentroidalVoronoiDiagram
()
{
}
template
<
typename
PFP
>
void
CentroidalVoronoiDiagram
<
PFP
>::
clear
()
{
VoronoiDiagram
<
PFP
>::
clear
();
distances
.
setAllValues
(
0.0
);
}
template
<
typename
PFP
>
void
CentroidalVoronoiDiagram
<
PFP
>::
collectVertexFromFront
(
Dart
e
){
distances
[
e
]
=
this
->
vertexInfo
[
e
].
it
->
first
();
pathOrigins
[
e
]
=
this
->
vertexInfo
[
e
].
pathOrigin
;
VoronoiDiagram
<
PFP
>::
collectVertexFromFront
(
e
);
}
}
// end namespace Geometry
}
// end namespace Algo
}
// end namespace CGoGN
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