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
Hurstel
CGoGN
Commits
9a60ef71
Commit
9a60ef71
authored
Jun 21, 2013
by
Sylvain Thery
Browse files
src file for checkXXXDegree functions
parent
6b80a81e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Topology/gmap/gmap2.cpp
View file @
9a60ef71
...
...
@@ -634,6 +634,20 @@ unsigned int GMap2::vertexDegree(Dart d)
return
count
;
}
int
GMap2
::
checkVertexDegree
(
Dart
d
,
unsigned
int
vd
)
{
unsigned
int
count
=
0
;
Dart
it
=
d
;
do
{
++
count
;
it
=
alpha1
(
it
)
;
}
while
((
count
<=
vd
)
&&
(
it
!=
d
))
;
return
count
-
vd
;
}
bool
GMap2
::
isBoundaryVertex
(
Dart
d
)
{
Dart
it
=
d
;
...
...
@@ -732,6 +746,43 @@ unsigned int GMap2::volumeDegree(Dart d)
return
count
;
}
int
GMap2
::
checkVolumeDegree
(
Dart
d
,
unsigned
int
volDeg
)
{
unsigned
int
count
=
0
;
DartMarkerStore
mark
(
*
this
);
// Lock a marker
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
16
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
std
::
vector
<
Dart
>::
iterator
face
;
// For every face added to the list
for
(
unsigned
int
i
=
0
;
i
!=
visitedFaces
.
size
();
++
i
)
{
Dart
df
=
visitedFaces
[
i
];
if
(
!
isBoundaryMarked2
(
df
)
&&
!
mark
.
isMarked
(
df
))
// Face has not been visited yet
{
++
count
;
Dart
it
=
df
;
do
{
mark
.
mark
(
it
);
// Mark
Dart
adj
=
phi2
(
it
);
// Get adjacent face
if
(
!
isBoundaryMarked2
(
adj
)
&&
!
mark
.
isMarked
(
adj
)
)
visitedFaces
.
push_back
(
adj
);
// Add it
it
=
phi1
(
it
);
}
while
(
it
!=
df
);
}
if
(
count
>
volDeg
)
break
;
}
return
count
-
volDeg
;
}
bool
GMap2
::
isTriangular
()
{
TraversorF
<
GMap2
>
t
(
*
this
)
;
...
...
src/Topology/gmap/gmap3.cpp
View file @
9a60ef71
...
...
@@ -24,6 +24,7 @@
#include
"Topology/gmap/gmap3.h"
#include
"Topology/generic/dartmarker.h"
#include
"Topology/generic/traversor3.h"
namespace
CGoGN
{
...
...
@@ -519,46 +520,74 @@ bool GMap3::sameVertex(Dart d, Dart e)
return
false
;
}
//unsigned int GMap3::vertexDegree(Dart d)
//{
// unsigned int count = 0;
// DartMarkerStore mv(*this); // Lock a marker
// std::vector<Dart> darts; // Darts that are traversed
// darts.reserve(256);
// darts.push_back(d); // Start with the dart d
// mv.mark(d);
// for(unsigned int i = 0; i < darts.size(); ++i)
// {
// //add phi21 and phi23 successor if they are not marked yet
// Dart d2 = phi2(darts[i]);
// Dart d21 = phi1(d2); // turn in volume
// Dart d23 = phi3(d2); // change volume
// if(!mv.isMarked(d21))
// {
// darts.push_back(d21);
// mv.mark(d21);
// }
// if(!mv.isMarked(d23))
// {
// darts.push_back(d23);
// mv.mark(d23);
// }
// }
// DartMarkerStore me(*this);
// for(std::vector<Dart>::iterator it = darts.begin(); it != darts.end() ; ++it)
// {
// if(!me.isMarked(*it))
// {
// ++count;
// me.markOrbit<EDGE>(*it);
// }
// }
// return count;
//}
unsigned
int
GMap3
::
vertexDegree
(
Dart
d
)
{
unsigned
int
count
=
0
;
DartMarkerStore
mv
(
*
this
);
// Lock a marker
std
::
vector
<
Dart
>
darts
;
// Darts that are traversed
darts
.
reserve
(
256
);
darts
.
push_back
(
d
);
// Start with the dart d
mv
.
mark
(
d
);
for
(
unsigned
int
i
=
0
;
i
<
darts
.
size
();
++
i
)
Traversor3VE
<
GMap3
>
trav3VE
(
*
this
,
d
);
for
(
Dart
dit
=
trav3VE
.
begin
()
;
dit
!=
trav3VE
.
end
()
;
dit
=
trav3VE
.
next
())
{
//add phi21 and phi23 successor if they are not marked yet
Dart
d2
=
phi2
(
darts
[
i
]);
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
if
(
!
mv
.
isMarked
(
d21
))
{
darts
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
if
(
!
mv
.
isMarked
(
d23
))
{
darts
.
push_back
(
d23
);
mv
.
mark
(
d23
);
}
++
count
;
}
DartMarkerStore
me
(
*
this
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
darts
.
begin
();
it
!=
darts
.
end
()
;
++
it
)
return
count
;
}
int
GMap3
::
checkVertexDegree
(
Dart
d
,
unsigned
int
vd
)
{
unsigned
int
count
=
0
;
Traversor3VE
<
GMap3
>
trav3VE
(
*
this
,
d
);
Dart
dit
=
trav3VE
.
begin
();
for
(
;
(
count
<=
vd
)
&&
(
dit
!=
trav3VE
.
end
())
;
dit
=
trav3VE
.
next
())
{
if
(
!
me
.
isMarked
(
*
it
))
{
++
count
;
me
.
markOrbit
<
EDGE
>
(
*
it
);
}
++
count
;
}
return
count
;
return
count
-
vd
;
}
bool
GMap3
::
isBoundaryVertex
(
Dart
d
)
...
...
src/Topology/map/map2.cpp
View file @
9a60ef71
...
...
@@ -619,6 +619,19 @@ unsigned int Map2::vertexDegree(Dart d)
return
count
;
}
int
Map2
::
checkVertexDegree
(
Dart
d
,
unsigned
int
vd
)
{
unsigned
int
count
=
0
;
Dart
it
=
d
;
do
{
++
count
;
it
=
phi2
(
phi_1
(
it
))
;
}
while
((
count
<=
vd
)
&&
(
it
!=
d
))
;
return
count
-
vd
;
}
bool
Map2
::
isBoundaryVertex
(
Dart
d
)
{
Dart
it
=
d
;
...
...
@@ -729,6 +742,43 @@ unsigned int Map2::volumeDegree(Dart d)
return
count
;
}
int
Map2
::
checkVolumeDegree
(
Dart
d
,
unsigned
int
volDeg
)
{
unsigned
int
count
=
0
;
DartMarkerStore
mark
(
*
this
);
// Lock a marker
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
16
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// For every face added to the list
for
(
unsigned
int
i
=
0
;
i
!=
visitedFaces
.
size
();
++
i
)
{
Dart
df
=
visitedFaces
[
i
];
if
(
!
isBoundaryMarked2
(
df
)
&&
!
mark
.
isMarked
(
df
))
// Face has not been visited yet
{
++
count
;
Dart
it
=
df
;
do
{
mark
.
mark
(
it
);
// Mark
Dart
adj
=
phi2
(
it
);
// Get adjacent face
if
(
!
isBoundaryMarked2
(
adj
)
&&
!
mark
.
isMarked
(
adj
)
)
visitedFaces
.
push_back
(
adj
);
// Add it
it
=
phi1
(
it
);
}
while
(
it
!=
df
);
}
if
(
count
>
volDeg
)
break
;
}
return
count
-
volDeg
;
}
bool
Map2
::
isTriangular
()
{
TraversorF
<
Map2
>
t
(
*
this
)
;
...
...
src/Topology/map/map3.cpp
View file @
9a60ef71
...
...
@@ -840,6 +840,22 @@ unsigned int Map3::vertexDegree(Dart d)
return
count
;
}
int
Map3
::
checkVertexDegree
(
Dart
d
,
unsigned
int
vd
)
{
unsigned
int
count
=
0
;
Traversor3VE
<
Map3
>
trav3VE
(
*
this
,
d
);
Dart
dit
=
trav3VE
.
begin
();
for
(
;
(
count
<=
vd
)
&&
(
dit
!=
trav3VE
.
end
())
;
dit
=
trav3VE
.
next
())
{
++
count
;
}
return
count
-
vd
;
}
unsigned
int
Map3
::
vertexDegreeOnBoundary
(
Dart
d
)
{
assert
(
Map3
::
isBoundaryVertex
(
d
));
...
...
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