Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
109fc559
Commit
109fc559
authored
Oct 28, 2011
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cell traversors
parent
b98800da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
205 additions
and
0 deletions
+205
-0
include/Topology/generic/traversor1.h
include/Topology/generic/traversor1.h
+82
-0
include/Topology/generic/traversor2.h
include/Topology/generic/traversor2.h
+123
-0
No files found.
include/Topology/generic/traversor1.h
View file @
109fc559
...
...
@@ -34,6 +34,47 @@ namespace CGoGN
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traverse all the vertices of the map
template
<
typename
MAP
>
class
TraversorV
{
private:
MAP
&
m
;
DartMarker
mark
;
Dart
current
;
public:
TraversorV
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
mark
(
map
)
{}
Dart
begin
()
{
mark
.
unmarkAll
()
;
current
=
m
.
begin
()
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
mark
.
markOrbit
(
VERTEX
,
current
)
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
if
(
current
!=
NIL
)
{
while
(
current
!=
NIL
&&
mark
.
isMarked
(
current
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
}
if
(
current
!=
NIL
)
mark
.
markOrbit
(
VERTEX
,
current
)
;
}
return
current
;
}
}
;
// Traverse the edges incident to a given vertex
template
<
typename
MAP
>
class
Traversor1VE
...
...
@@ -111,6 +152,47 @@ public:
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse all the vertices of the map
template
<
typename
MAP
>
class
TraversorE
{
private:
MAP
&
m
;
DartMarker
mark
;
Dart
current
;
public:
TraversorE
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
mark
(
map
)
{}
Dart
begin
()
{
mark
.
unmarkAll
()
;
current
=
m
.
begin
()
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
mark
.
markOrbit
(
EDGE
,
current
)
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
if
(
current
!=
NIL
)
{
while
(
current
!=
NIL
&&
mark
.
isMarked
(
current
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
}
if
(
current
!=
NIL
)
mark
.
markOrbit
(
EDGE
,
current
)
;
}
return
current
;
}
}
;
// Traverse the vertices incident to a given edge
template
<
typename
MAP
>
class
Traversor1EV
...
...
include/Topology/generic/traversor2.h
View file @
109fc559
...
...
@@ -34,6 +34,47 @@ namespace CGoGN
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traverse all the vertices of the map
template
<
typename
MAP
>
class
TraversorV
{
private:
MAP
&
m
;
DartMarker
mark
;
Dart
current
;
public:
TraversorV
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
mark
(
map
)
{}
Dart
begin
()
{
mark
.
unmarkAll
()
;
current
=
m
.
begin
()
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
mark
.
markOrbit
(
VERTEX
,
current
)
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
if
(
current
!=
NIL
)
{
while
(
current
!=
NIL
&&
mark
.
isMarked
(
current
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
}
if
(
current
!=
NIL
)
mark
.
markOrbit
(
VERTEX
,
current
)
;
}
return
current
;
}
}
;
// Traverse the edges incident to a given vertex
template
<
typename
MAP
>
class
Traversor2VE
...
...
@@ -169,6 +210,47 @@ public:
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse all the edges of the map
template
<
typename
MAP
>
class
TraversorE
{
private:
MAP
&
m
;
DartMarker
mark
;
Dart
current
;
public:
TraversorE
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
mark
(
map
)
{}
Dart
begin
()
{
mark
.
unmarkAll
()
;
current
=
m
.
begin
()
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
mark
.
markOrbit
(
EDGE
,
current
)
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
if
(
current
!=
NIL
)
{
while
(
current
!=
NIL
&&
mark
.
isMarked
(
current
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
}
if
(
current
!=
NIL
)
mark
.
markOrbit
(
EDGE
,
current
)
;
}
return
current
;
}
}
;
// Traverse the vertices incident to a given edge
template
<
typename
MAP
>
class
Traversor2EV
...
...
@@ -297,6 +379,47 @@ public:
FACE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse all the faces of the map
template
<
typename
MAP
>
class
TraversorF
{
private:
MAP
&
m
;
DartMarker
mark
;
Dart
current
;
public:
TraversorF
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
mark
(
map
)
{}
Dart
begin
()
{
mark
.
unmarkAll
()
;
current
=
m
.
begin
()
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
mark
.
markOrbit
(
FACE
,
current
)
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
if
(
current
!=
NIL
)
{
while
(
current
!=
NIL
&&
mark
.
isMarked
(
current
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
}
if
(
current
!=
NIL
)
mark
.
markOrbit
(
FACE
,
current
)
;
}
return
current
;
}
}
;
// Traverse the vertices incident to a given face
template
<
typename
MAP
>
class
Traversor2FV
...
...
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