Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
5feedc27
Commit
5feedc27
authored
Aug 27, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~sauvage/CGoGN
Conflicts: include/Algo/Selection/collector.h
parents
63ca7b83
21bb3f51
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
622 additions
and
18 deletions
+622
-18
include/Algo/Geometry/voronoiDiagrams.h
include/Algo/Geometry/voronoiDiagrams.h
+67
-0
include/Algo/Geometry/voronoiDiagrams.hpp
include/Algo/Geometry/voronoiDiagrams.hpp
+129
-0
include/Algo/Histogram/histogram.hpp
include/Algo/Histogram/histogram.hpp
+2
-0
include/Algo/Selection/collector.h
include/Algo/Selection/collector.h
+86
-7
include/Algo/Selection/collector.hpp
include/Algo/Selection/collector.hpp
+338
-11
No files found.
include/Algo/Geometry/voronoiDiagrams.h
0 → 100644
View file @
5feedc27
#ifndef __VORONOI_DIAGRAMS_H__
#define __VORONOI_DIAGRAMS_H__
#include <vector>
#include <map>
#include "Topology/generic/traversor2.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
Geometry
{
template
<
typename
PFP
>
class
VoronoiDiagram
{
private
:
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
struct
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
unsigned
int
region
;
static
std
::
string
CGoGNnameOfType
()
{
return
"VoronoiVertexInfo"
;
}
}
VoronoiVertexInfo
;
typedef
NoMathIOAttribute
<
VoronoiVertexInfo
>
VertexInfo
;
typename
PFP
::
MAP
&
map
;
const
EdgeAttribute
<
REAL
>&
edgeCost
;
// weights on the graph edges
// const VertexAttribute<VEC3>& position; // positions
VertexAttribute
<
unsigned
int
>&
regions
;
// region labels
std
::
vector
<
Dart
>
border
;
std
::
vector
<
Dart
>
seeds
;
VertexAttribute
<
VertexInfo
>
vertexInfo
;
std
::
multimap
<
float
,
Dart
>
front
;
CellMarkerStore
<
VERTEX
>
vmReached
;
public
:
VoronoiDiagram
(
typename
PFP
::
MAP
&
m
,
const
EdgeAttribute
<
REAL
>&
c
,
VertexAttribute
<
unsigned
int
>&
r
);
~
VoronoiDiagram
();
const
std
::
vector
<
Dart
>&
getSeeds
(){
return
seeds
;}
void
setSeeds
(
const
std
::
vector
<
Dart
>&
);
void
setRandomSeeds
(
unsigned
int
nbseeds
);
const
std
::
vector
<
Dart
>&
getBorder
(){
return
border
;}
void
setCost
(
const
EdgeAttribute
<
REAL
>&
c
);
void
computeDiagram
();
private
:
void
clear
();
void
initFrontWithSeeds
();
};
}
// end namespace Geometry
}
// end namespace Algo
}
// end namespace CGoGN
#include "voronoiDiagrams.hpp"
#endif
include/Algo/Geometry/voronoiDiagrams.hpp
0 → 100644
View file @
5feedc27
namespace
CGoGN
{
namespace
Algo
{
namespace
Geometry
{
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
)
{
vertexInfo
=
map
.
template
addAttribute
<
VertexInfo
,
VERTEX
>(
"vertexInfo"
);
}
template
<
typename
PFP
>
VoronoiDiagram
<
PFP
>::~
VoronoiDiagram
()
{
map
.
removeAttribute
(
vertexInfo
);
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
clear
()
{
border
.
clear
();
regions
.
setAllValues
(
0
);
border
.
clear
();
seeds
.
clear
();
front
.
clear
();
vmReached
.
unmarkAll
();
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
setSeeds
(
const
std
::
vector
<
Dart
>&
s
)
{
clear
();
seeds
=
s
;
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
setRandomSeeds
(
unsigned
int
nseeds
)
{
clear
();
srand
(
time
(
NULL
)
);
unsigned
int
n
=
nseeds
;
while
(
n
>
0
)
{
// TODO : correct this random init which assumes contiguous Dart table
Dart
d
=
rand
()
%
map
.
getNbDarts
()
;
if
(
!
vmReached
.
isMarked
(
d
))
{
vmReached
.
mark
(
d
);
seeds
.
push_back
(
d
);
n
--
;
}
}
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
initFrontWithSeeds
()
{
vmReached
.
unmarkAll
();
for
(
unsigned
int
i
=
0
;
i
<
seeds
.
size
();
i
++
)
{
Dart
d
=
seeds
[
i
];
vmReached
.
mark
(
d
);
vertexInfo
[
d
].
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
0.0
,
d
));
vertexInfo
[
d
].
valid
=
true
;
vertexInfo
[
d
].
region
=
i
;
}
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
setCost
(
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
c
){
edgeCost
=
c
;
}
template
<
typename
PFP
>
void
VoronoiDiagram
<
PFP
>::
computeDiagram
()
{
initFrontWithSeeds
();
while
(
!
front
.
empty
()
)
{
Dart
e
=
front
.
begin
()
->
second
;
float
d
=
front
.
begin
()
->
first
;
front
.
erase
(
vertexInfo
[
e
].
it
);
vertexInfo
[
e
].
valid
=
false
;
regions
[
e
]
=
vertexInfo
[
e
].
region
;
Traversor2VVaE
<
typename
PFP
::
MAP
>
tv
(
map
,
e
);
for
(
Dart
f
=
tv
.
begin
();
f
!=
tv
.
end
();
f
=
tv
.
next
())
{
VertexInfo
&
vi
(
vertexInfo
[
f
]);
if
(
vmReached
.
isMarked
(
f
))
{
if
(
vi
.
valid
)
// probably useless (because of distance test) but faster
{
// float dist = d + Algo::Geometry::edgeLength<PFP>(map,f,position);
float
dist
=
d
+
edgeCost
[
f
];
if
(
dist
<
vi
.
it
->
first
)
{
front
.
erase
(
vi
.
it
);
vi
.
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
dist
,
f
));
vi
.
region
=
regions
[
e
];
}
}
else
{
if
(
regions
[
f
]
!=
regions
[
e
]
)
border
.
push_back
(
f
);
}
}
else
{
// vi.it = front.insert(std::pair<float,Dart>(d + Algo::Geometry::edgeLength<PFP>(map,f,position), f));
vi
.
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
d
+
edgeCost
[
f
],
f
));
vi
.
valid
=
true
;
vi
.
region
=
regions
[
e
];
vmReached
.
mark
(
f
);
}
}
}
}
}
// end namespace Geometry
}
// end namespace Algo
}
// end namespace CGoGN
include/Algo/Histogram/histogram.hpp
View file @
5feedc27
...
...
@@ -134,6 +134,7 @@ inline void Histogram::initData(const ATTR& attr)
m_max
=
m_min
;
m_dataIdx
.
reserve
(
attr
.
nbElements
());
m_dataIdx
.
clear
();
for
(
unsigned
int
i
=
beg
;
i
!=
attr
.
end
();
attr
.
next
(
i
))
{
double
val
=
attr
[
i
];
...
...
@@ -147,6 +148,7 @@ inline void Histogram::initData(const ATTR& attr)
m_hcolmap
.
setMin
(
m_min
);
m_hcolmap
.
setMax
(
m_max
);
m_sorted
=
false
;
}
...
...
include/Algo/Selection/collector.h
View file @
5feedc27
...
...
@@ -151,8 +151,7 @@ public:
Collector
<
PFP
>
(
m
,
thread
),
position
(
p
),
radius
(
r
),
area
(
0
),
m_thread
(
thread
)
area
(
0
)
{}
inline
void
setRadius
(
typename
PFP
::
REAL
r
)
{
radius
=
r
;
}
inline
typename
PFP
::
REAL
getRadius
()
const
{
return
radius
;
}
...
...
@@ -166,7 +165,7 @@ public:
};
/*********************************************************
* Collector Normal Angle
* Collector Normal Angle
(Vertices)
*********************************************************/
/*
...
...
@@ -178,28 +177,108 @@ template <typename PFP>
class
Collector_NormalAngle
:
public
Collector
<
PFP
>
{
protected:
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
;
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
;
typename
PFP
::
REAL
angleThreshold
;
public:
Collector_NormalAngle
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
n
,
typename
PFP
::
REAL
a
,
unsigned
int
thread
=
0
)
:
Collector
<
PFP
>
(
m
,
thread
),
position
(
p
),
normal
(
n
),
angleThreshold
(
a
)
)
:
Collector
<
PFP
>
(
m
,
thread
),
normal
(
n
),
angleThreshold
(
a
)
{}
inline
void
setAngleThreshold
(
typename
PFP
::
REAL
a
)
{
angleThreshold
=
a
;
}
inline
typename
PFP
::
REAL
getAngleThreshold
()
const
{
return
angleThreshold
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getPosition
()
const
{
return
position
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getNormal
()
const
{
return
normal
;
}
void
collectAll
(
Dart
d
)
;
void
collectBorder
(
Dart
d
)
;
};
/*********************************************************
* Collector Normal Angle (Triangles)
*********************************************************/
/*
* collect all primitives of the connected component containing "centerDart"
* the angle between the included triangles normal vectors and the central normal vector
* stays under a given threshold
*/
template
<
typename
PFP
>
class
Collector_NormalAngle_Triangles
:
public
Collector
<
PFP
>
{
protected:
const
FaceAttribute
<
typename
PFP
::
VEC3
>&
normal
;
typename
PFP
::
REAL
angleThreshold
;
public:
Collector_NormalAngle_Triangles
(
typename
PFP
::
MAP
&
m
,
const
FaceAttribute
<
typename
PFP
::
VEC3
>&
n
,
typename
PFP
::
REAL
a
,
unsigned
int
thread
=
0
)
:
Collector
<
PFP
>
(
m
,
thread
),
normal
(
n
),
angleThreshold
(
a
)
{}
inline
void
setAngleThreshold
(
typename
PFP
::
REAL
a
)
{
angleThreshold
=
a
;
}
inline
typename
PFP
::
REAL
getAngleThreshold
()
const
{
return
angleThreshold
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getNormal
()
const
{
return
normal
;
}
void
collectAll
(
Dart
d
)
;
void
collectBorder
(
Dart
d
)
;
};
/*********************************************************
* Collector Dijkstra
*********************************************************/
/*
* collect all primitives of the connected component containing "centerDart"
* within a distance < maxDist (the shortest path follows edges)
*/
template
<
typename
PFP
>
class
Collector_Dijkstra
:
public
Collector
<
PFP
>
{
protected:
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
;
typename
PFP
::
REAL
maxDist
;
typedef
struct
{
typename
std
::
multimap
<
float
,
Dart
>::
iterator
it
;
bool
valid
;
static
std
::
string
CGoGNnameOfType
()
{
return
"DijkstraVertexInfo"
;
}
}
DijkstraVertexInfo
;
typedef
NoMathIOAttribute
<
DijkstraVertexInfo
>
VertexInfo
;
VertexAttribute
<
VertexInfo
>
vertexInfo
;
std
::
multimap
<
float
,
Dart
>
front
;
public:
Collector_Dijkstra
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
,
typename
PFP
::
REAL
d
=
0
,
unsigned
int
thread
=
0
)
:
Collector
<
PFP
>
(
m
,
thread
),
position
(
p
),
maxDist
(
d
)
{
vertexInfo
=
m
.
template
addAttribute
<
VertexInfo
,
VERTEX
>(
"vertexInfo"
);
}
~
Collector_Dijkstra
(){
this
->
map
.
removeAttribute
(
vertexInfo
);
}
inline
void
init
(
Dart
d
)
{
Collector
<
PFP
>::
init
(
d
);
front
.
clear
();}
inline
void
setMaxDistance
(
typename
PFP
::
REAL
d
)
{
maxDist
=
d
;
}
inline
typename
PFP
::
REAL
getMaxDist
()
const
{
return
maxDist
;
}
inline
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
getPosition
()
const
{
return
position
;
}
void
collectAll
(
Dart
d
);
void
collectBorder
(
Dart
d
);
private
:
inline
float
edgeLength
(
Dart
d
);
// inline Dart oppositeVertex (Dart d);
};
}
// namespace Selection
}
// namespace Algo
...
...
include/Algo/Selection/collector.hpp
View file @
5feedc27
...
...
@@ -24,6 +24,7 @@
#include "Topology/generic/traversor2.h"
#include "Algo/Geometry/intersection.h"
#include <queue>
namespace
CGoGN
{
...
...
@@ -149,9 +150,9 @@ void Collector_WithinSphere<PFP>::collectAll(Dart d)
this
->
insideFaces
.
reserve
(
32
);
this
->
border
.
reserve
(
32
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
m_thread
);
// mark the collected inside-faces + border-faces
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces + border-faces
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
...
...
@@ -211,8 +212,8 @@ void Collector_WithinSphere<PFP>::collectBorder(Dart d)
this
->
border
.
reserve
(
128
);
this
->
insideVertices
.
reserve
(
128
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-edges + border-edges
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
...
...
@@ -281,7 +282,7 @@ void Collector_WithinSphere<PFP>::computeArea()
}
/*********************************************************
* Collector Normal Angle
* Collector Normal Angle
(Vertices)
*********************************************************/
template
<
typename
PFP
>
...
...
@@ -295,9 +296,9 @@ void Collector_NormalAngle<PFP>::collectAll(Dart d)
this
->
insideFaces
.
reserve
(
32
);
this
->
border
.
reserve
(
32
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
m_thread
);
// mark the collected inside-faces + border-faces
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces + border-faces
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
...
...
@@ -360,8 +361,8 @@ void Collector_NormalAngle<PFP>::collectBorder(Dart d)
this
->
border
.
reserve
(
128
);
this
->
insideVertices
.
reserve
(
128
);
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
m_thread
);
// mark the collected inside-edges + border-edges
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-edges + border-edges
this
->
insideVertices
.
push_back
(
this
->
centerDart
);
vm
.
mark
(
this
->
centerDart
);
...
...
@@ -401,6 +402,332 @@ void Collector_NormalAngle<PFP>::collectBorder(Dart d)
this
->
insideVertices
.
clear
();
}
/*********************************************************
* Collector Normal Angle (Triangles)
*********************************************************/
template
<
typename
PFP
>
void
Collector_NormalAngle_Triangles
<
PFP
>::
collectAll
(
Dart
d
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
this
->
init
(
d
);
this
->
insideVertices
.
reserve
(
32
);
this
->
insideEdges
.
reserve
(
32
);
this
->
insideFaces
.
reserve
(
32
);
this
->
border
.
reserve
(
32
);
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces + front-faces
CellMarkerStore
<
FACE
>
fminside
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces
std
::
queue
<
Dart
>
front
;
front
.
push
(
this
->
centerDart
);
fm
.
mark
(
this
->
centerDart
);
VEC3
centerNormal
=
this
->
normal
[
this
->
centerDart
];
while
(
!
front
.
empty
()
)
// collect inside faces
{
Dart
f
=
front
.
front
();
front
.
pop
();
REAL
a
=
Geom
::
angle
(
centerNormal
,
this
->
normal
[
f
]);
if
(
a
<
angleThreshold
)
{
// collect this face and add adjacent faces to the front
this
->
insideFaces
.
push_back
(
f
);
fminside
.
mark
(
f
);
Traversor2FFaE
<
typename
PFP
::
MAP
>
t
(
this
->
map
,
f
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
if
(
!
fm
.
isMarked
(
it
))
{
front
.
push
(
it
);
fm
.
mark
(
it
);
}
}
}
}
CellMarkerStore
<
VERTEX
>
vm
(
this
->
map
,
this
->
m_thread
);
// mark inside-vertices and border-vertices
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark inside-edges and border-edges
std
::
vector
<
Dart
>::
iterator
f_it
;
for
(
f_it
=
this
->
insideFaces
.
begin
();
f_it
!=
this
->
insideFaces
.
end
();
f_it
++
)
{
// collect insideVertices, insideEdges, and border
Traversor2FE
<
typename
PFP
::
MAP
>
te
(
this
->
map
,
*
f_it
)
;
for
(
Dart
it
=
te
.
begin
();
it
!=
te
.
end
();
it
=
te
.
next
())
{
// collect insideEdges and border
if
(
!
em
.
isMarked
(
it
))
{
em
.
mark
(
it
);
if
(
this
->
map
.
isBoundaryEdge
(
it
))
this
->
border
.
push_back
(
it
);
else
if
(
fminside
.
isMarked
(
it
)
&&
fminside
.
isMarked
(
this
->
map
.
phi2
(
it
))
)
this
->
insideEdges
.
push_back
(
it
);
else
this
->
border
.
push_back
(
it
);
}
}
Traversor2FV
<
typename
PFP
::
MAP
>
tv
(
this
->
map
,
*
f_it
)
;
for
(
Dart
it
=
tv
.
begin
();
it
!=
tv
.
end
();
it
=
tv
.
next
())
{
// collect insideVertices
if
(
!
vm
.
isMarked
(
it
))
{
vm
.
mark
(
it
);
this
->
insideVertices
.
push_back
(
it
);
// if ( !this->map.isBoundaryVertex(it))
// {
// Traversor2VF<typename PFP::MAP> tf (this->map, it);
// Dart it2 = tf.begin();
// while ( (it2 != tf.end()) && fminside.isMarked(it2))
// it2=tf.next();
// if (it2 == tf.end())
// this->insideVertices.push_back(it);
// }
}
}
}
}
template
<
typename
PFP
>
void
Collector_NormalAngle_Triangles
<
PFP
>::
collectBorder
(
Dart
d
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
this
->
init
(
d
);
this
->
insideFaces
.
reserve
(
32
);
this
->
border
.
reserve
(
32
);
CellMarkerStore
<
FACE
>
fm
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces + front-faces
CellMarkerStore
<
FACE
>
fminside
(
this
->
map
,
this
->
m_thread
);
// mark the collected inside-faces
std
::
queue
<
Dart
>
front
;
front
.
push
(
this
->
centerDart
);
fm
.
mark
(
this
->
centerDart
);
VEC3
centerNormal
=
this
->
normal
[
this
->
centerDart
];
while
(
!
front
.
empty
()
)
// collect inside faces
{
Dart
f
=
front
.
front
();
front
.
pop
();
REAL
a
=
Geom
::
angle
(
centerNormal
,
this
->
normal
[
f
]);
if
(
a
<
angleThreshold
)
{
// collect this face and add adjacent faces to the front
this
->
insideFaces
.
push_back
(
f
);
fminside
.
mark
(
f
);
Traversor2FFaE
<
typename
PFP
::
MAP
>
t
(
this
->
map
,
f
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
if
(
!
fm
.
isMarked
(
it
))
{
front
.
push
(
it
);
fm
.
mark
(
it
);
}
}
}
}
CellMarkerStore
<
EDGE
>
em
(
this
->
map
,
this
->
m_thread
);
// mark inside-edges and border-edges
std
::
vector
<
Dart
>::
iterator
f_it
;
for
(
f_it
=
this
->
insideFaces
.
begin
();
f_it
!=
this
->
insideFaces
.
end
();
f_it
++
)
{
// collect border (edges)
Traversor2FE
<
typename
PFP
::
MAP
>
te
(
this
->
map
,
*
f_it
)
;
for
(
Dart
it
=
te
.
begin
();
it
!=
te
.
end
();
it
=
te
.
next
())
{
if
(
!
em
.
isMarked
(
it
))
{
em
.
mark
(
it
);
if
(
this
->
map
.
isBoundaryEdge
(
it
))
this
->
border
.
push_back
(
it
);
else
if
(
!
fminside
.
isMarked
(
it
)
||
!
fminside
.
isMarked
(
this
->
map
.
phi2
(
it
))
)
this
->
border
.
push_back
(
it
);
}
}
}
this
->
insideFaces
.
clear
();
}
/*********************************************************
* Collector Dijkstra
*********************************************************/
template
<
typename
PFP
>
void
Collector_Dijkstra
<
PFP
>::
collectAll
(
Dart
dinit
)
{
init
(
dinit
);
CellMarkerStore
<
VERTEX
>
vmReached
(
this
->
map
,
this
->
m_thread
);
vertexInfo
[
this
->
centerDart
].
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
0.0
,
this
->
centerDart
));
vertexInfo
[
this
->
centerDart
].
valid
=
true
;
vmReached
.
mark
(
this
->
centerDart
);
while
(
!
front
.
empty
()
&&
front
.
begin
()
->
first
<
this
->
maxDist
)
{
Dart
e
=
front
.
begin
()
->
second
;
float
d
=
front
.
begin
()
->
first
;
front
.
erase
(
vertexInfo
[
e
].
it
);
vertexInfo
[
e
].
valid
=
false
;
this
->
insideVertices
.
push_back
(
e
);
Traversor2VVaE
<
typename
PFP
::
MAP
>
tv
(
this
->
map
,
e
);
for
(
Dart
f
=
tv
.
begin
();
f
!=
tv
.
end
();
f
=
tv
.
next
())
{
VertexInfo
&
vi
(
vertexInfo
[
f
]);
if
(
vmReached
.
isMarked
(
f
))
{
if
(
vi
.
valid
)
// probably useless (because of distance test) but faster
{
float
dist
=
d
+
edgeLength
(
f
);
if
(
dist
<
vi
.
it
->
first
)
{
front
.
erase
(
vi
.
it
);
vi
.
it
=
front
.
insert
(
std
::
pair
<
float
,
Dart
>
(
dist
,
f
));
}
}
}