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
David Cazier
CGoGN
Commits
72af75e4
Commit
72af75e4
authored
Nov 03, 2011
by
Pierre Kraemer
Browse files
la suite..
parent
1db1b9af
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/Topology/generic/embeddedMap2.h
View file @
72af75e4
...
...
@@ -32,13 +32,14 @@ namespace CGoGN
/**
* Class of 2-dimensional maps
* with
lazily
managed embeddings
* with managed embeddings
*/
template
<
typename
MAP2
>
class
EmbeddedMap2
:
public
MAP2
{
public:
typedef
MAP2
TOPO_MAP
;
/**
* The attributes attached to the old vertex are duplicated on both resulting vertices
* No attribute is attached to the new edge
...
...
@@ -65,7 +66,7 @@ public:
/**
* The attributes attached to the edge of d are kept on the resulting edge
*/
virtual
void
uncutEdge
(
Dart
d
)
;
virtual
bool
uncutEdge
(
Dart
d
)
;
/**
* Check if the edge of d can be collapsed or not based on some topological conditions
...
...
include/Topology/generic/embeddedMap2.hpp
View file @
72af75e4
...
...
@@ -102,23 +102,20 @@ void EmbeddedMap2<MAP2>::cutEdge(Dart d)
{
MAP2
::
copyDartEmbedding
(
FACE
,
MAP2
::
phi1
(
d
),
d
)
;
Dart
e
=
MAP2
::
phi2
(
nd
)
;
if
(
e
!=
nd
)
MAP2
::
copyDartEmbedding
(
FACE
,
MAP2
::
phi1
(
e
),
e
)
;
MAP2
::
copyDartEmbedding
(
FACE
,
MAP2
::
phi1
(
e
),
e
)
;
}
}
template
<
typename
MAP2
>
void
EmbeddedMap2
<
MAP2
>::
uncutEdge
(
Dart
d
)
bool
EmbeddedMap2
<
MAP2
>::
uncutEdge
(
Dart
d
)
{
bool
doSomethg
=
(
d
!=
MAP2
::
phi2
(
d
))
;
MAP2
::
uncutEdge
(
d
)
;
if
(
doSomethg
)
if
(
MAP2
::
uncutEdge
(
d
))
{
if
(
MAP2
::
isOrbitEmbedded
(
EDGE
))
MAP2
::
copyDartEmbedding
(
EDGE
,
MAP2
::
phi2
(
d
),
d
)
;
return
true
;
}
return
false
;
}
template
<
typename
MAP2
>
...
...
include/Topology/map/map2.h
View file @
72af75e4
...
...
@@ -95,7 +95,6 @@ protected:
*/
void
phi2unsew
(
Dart
d
);
//! merge a face that has been tag as boundary with existing boundary if needed
/* @param d a dart of the face
*/
...
...
@@ -106,8 +105,6 @@ protected:
*/
void
mergeBoundaryFaces
(
Dart
dd
,
Dart
ee
);
/*! @name Generator and Deletor
* To generate or delete faces in a 2-map
*************************************************************************/
...
...
@@ -123,8 +120,6 @@ public:
virtual
void
deleteFace
(
Dart
d
)
;
//@}
/*! @name Topological Operators
* Topological operations on 2-maps
*************************************************************************/
...
...
@@ -137,7 +132,6 @@ public:
*/
virtual
void
splitVertex
(
Dart
d
,
Dart
e
);
// OK boundary
//! Delete the vertex of d (works only for internal vertices)
/*! All the faces around the vertex are merged into one face
* @param d a dart of the vertex to delete
...
...
@@ -145,7 +139,6 @@ public:
*/
virtual
bool
deleteVertex
(
Dart
d
)
;
// OK boundary
//! Link two vertices belonging to distinct faces (add an edge between the two vertices)
/*! \pre Dart d and e MUST be different and belong to distinct face
* @param d first dart in the face
...
...
@@ -153,18 +146,16 @@ public:
*/
virtual
void
linkVertices
(
Dart
d
,
Dart
e
);
//TODO removing ??
//! Cut the edge of d and its opposite edge if it exists
//! Cut the edge of d
/*! @param d a dart of the edge to cut
*/
virtual
void
cutEdge
(
Dart
d
);
// OK boundary
//! Undo the cut of the edge of d and its opposite edge if it exists
//! Undo the cut of the edge of d
/*! @param d a dart of the edge to uncut
* @return true if the uncut has been executed, false otherwise
*/
virtual
void
uncutEdge
(
Dart
d
);
// OK boundary
virtual
bool
uncutEdge
(
Dart
d
);
// OK boundary
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
...
...
@@ -178,7 +169,6 @@ public:
*/
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
);
//TODO close degenerated boundary ???
/**
* Flip the edge of d (rotation in phi1 order)
* WARNING : Works only for non-border edges.
...
...
@@ -332,10 +322,15 @@ public:
Dart
findBoundaryVertex
(
Dart
d
);
/**
* tell if the
vertex
of d is on the boundary of the map
* tell if the
edge
of d is on the boundary of the map
*/
bool
isBoundaryEdge
(
Dart
d
)
;
// OK boundary
/**
* tell if the face of d is on the boundary of the map
*/
bool
isBoundaryFace
(
Dart
d
)
;
//! Follow the boundary of a surface as if it was a oriented face.
/*! This operation alternate phi1 and phi2 operator until another
...
...
include/Topology/map/map3.h
View file @
72af75e4
...
...
@@ -150,7 +150,7 @@ public:
//! Uncut the edge of d
/*! @param d a dart of the edge to uncut
*/
virtual
void
uncutEdge
(
Dart
d
);
virtual
bool
uncutEdge
(
Dart
d
);
//!
/*!
...
...
src/Topology/map/map2.cpp
View file @
72af75e4
...
...
@@ -140,10 +140,9 @@ void Map2::cutEdge(Dart d)
phi2sew
(
d
,
ne
);
// Correct the phi2 links
phi2sew
(
e
,
nd
);
}
void
Map2
::
uncutEdge
(
Dart
d
)
bool
Map2
::
uncutEdge
(
Dart
d
)
{
// assert(vertexDegree(phi1(d)) == 2) ;
// Dart ne = phi2(d) ;
...
...
@@ -160,15 +159,19 @@ void Map2::uncutEdge(Dart d)
// phi2sew(d, e) ;
// }
assert
(
vertexDegree
(
phi1
(
d
))
==
2
)
;
Dart
ne
=
phi2
(
d
)
;
Dart
nd
=
phi1
(
d
)
;
Dart
e
=
phi_1
(
ne
)
;
phi2unsew
(
e
)
;
phi2unsew
(
d
)
;
Map1
::
collapseEdge
(
nd
)
;
Map1
::
collapseEdge
(
ne
)
;
phi2sew
(
d
,
e
)
;
if
(
vertexDegree
(
phi1
(
d
))
==
2
)
{
Dart
ne
=
phi2
(
d
)
;
Dart
nd
=
phi1
(
d
)
;
Dart
e
=
phi_1
(
ne
)
;
phi2unsew
(
e
)
;
phi2unsew
(
d
)
;
Map1
::
collapseEdge
(
nd
)
;
Map1
::
collapseEdge
(
ne
)
;
phi2sew
(
d
,
e
)
;
return
true
;
}
return
false
;
}
...
...
@@ -222,7 +225,7 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
//
// return resV ;
Dart
resV
=
Dart
::
nil
()
;
Dart
resV
=
NIL
;
Dart
e
=
phi2
(
d
);
phi2unsew
(
d
);
// Unlink the opposite edges
...
...
@@ -231,7 +234,7 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
{
Dart
f
=
phi1
(
e
)
;
Map1
::
collapseEdge
(
e
)
;
// Collapse edge e
if
(
f
!=
e
)
if
(
f
!=
e
)
collapseDegeneratedFace
(
f
)
;
// and collapse its face if degenerated
}
else
...
...
@@ -261,7 +264,7 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
{
Dart
f
=
phi1
(
d
)
;
Map1
::
collapseEdge
(
d
)
;
// Collapse edge d
if
(
f
!=
d
)
if
(
f
!=
d
)
collapseDegeneratedFace
(
f
)
;
// and collapse its face if degenerated
}
else
...
...
@@ -269,7 +272,7 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
Dart
f
=
phi1
(
d
)
;
Dart
g
=
phi_1
(
d
)
;
if
(
resV
==
Dart
::
nil
()
)
if
(
resV
==
NIL
)
{
if
(
f
!=
e
&&
!
isFaceTriangle
(
d
))
resV
=
f
;
...
...
@@ -314,8 +317,6 @@ bool Map2::flipBackEdge(Dart d)
if
(
!
isBoundaryEdge
(
d
))
{
Dart
e
=
phi2
(
d
);
Dart
dNext
=
phi1
(
d
);
Dart
eNext
=
phi1
(
e
);
Dart
dPrev
=
phi_1
(
d
);
Dart
ePrev
=
phi_1
(
e
);
phi1sew
(
d
,
ePrev
);
// Detach the two
...
...
@@ -329,14 +330,14 @@ bool Map2::flipBackEdge(Dart d)
void
Map2
::
insertEdgeInVertex
(
Dart
d
,
Dart
e
)
{
assert
(
!
sameVertex
(
d
,
e
)
&&
phi2
(
e
)
==
phi_1
(
e
));
assert
(
!
sameVertex
(
d
,
e
)
&&
phi2
(
e
)
==
phi_1
(
e
));
phi1sew
(
phi_1
(
d
),
phi_1
(
e
));
}
void
Map2
::
removeEdgeFromVertex
(
Dart
d
)
{
assert
(
phi2
(
d
)
!=
d
);
assert
(
phi2
(
d
)
!=
d
);
phi1sew
(
phi_1
(
d
),
phi2
(
d
));
}
...
...
@@ -379,13 +380,11 @@ void Map2::unsewFaces(Dart d)
// sew faces to the boundary
phi2sew
(
d
,
e
);
phi2sew
(
dd
,
phi1
(
e
));
}
bool
Map2
::
collapseDegeneratedFace
(
Dart
d
)
{
Dart
e
=
phi1
(
d
);
// Check if the face is
a loop
Dart
e
=
phi1
(
d
);
// Check if the face is
degenerated
if
(
phi1
(
e
)
==
d
)
// Yes: it contains one or two edge(s)
{
Dart
d2
=
phi2
(
d
);
// Check opposite edges
...
...
@@ -778,15 +777,6 @@ unsigned int Map2::volumeDegree(Dart d)
bool
Map2
::
isBoundaryVertex
(
Dart
d
)
{
// Dart dNext = d ;
// do
// {
// if(phi2(dNext) == dNext)
// return true ;
// dNext = alpha1(dNext) ;
// } while (dNext != d) ;
// return false ;
Dart
dNext
=
d
;
do
{
...
...
@@ -809,13 +799,23 @@ Dart Map2::findBoundaryVertex(Dart d)
return
Dart
::
nil
();
}
bool
Map2
::
isBoundaryEdge
(
Dart
d
)
{
Dart
e
=
phi2
(
d
);
return
isBoundaryMarked
(
e
)
||
isBoundaryMarked
(
d
);
return
isBoundaryMarked
(
e
)
||
isBoundaryMarked
(
d
);
}
bool
Map2
::
isBoundaryFace
(
Dart
d
)
{
Dart
it
=
d
;
do
{
if
(
isBoundaryMarked
(
phi2
(
it
)))
return
true
;
it
=
phi1
(
it
)
;
}
while
(
it
!=
d
)
;
return
false
;
}
Dart
Map2
::
nextOnBoundary
(
Dart
d
)
{
...
...
@@ -848,15 +848,10 @@ bool Map2::isTriangular()
if
(
!
m
.
isMarked
(
d
))
{
m
.
markOrbit
(
FACE
,
d
)
;
Dart
dd
=
d
;
// ???
if
(
!
isBoundaryMarked
(
d
))
{
bool
t
=
isFaceTriangle
(
d
)
;
if
(
!
t
)
{
if
(
!
isFaceTriangle
(
d
))
return
false
;
}
}
}
}
...
...
@@ -875,6 +870,11 @@ bool Map2::check()
CGoGNout
<<
"Check: phi2 is not an involution"
<<
CGoGNendl
;
return
false
;
}
if
(
d2
==
d
)
{
CGoGNout
<<
"Check: phi2 fixed point"
<<
CGoGNendl
;
return
false
;
}
Dart
d1
=
phi1
(
d
);
if
(
phi_1
(
d1
)
!=
d
)
// phi1 a une image correcte ?
...
...
src/Topology/map/map3.cpp
View file @
72af75e4
...
...
@@ -178,29 +178,33 @@ void Map3::cutEdge(Dart d)
}
}
void
Map3
::
uncutEdge
(
Dart
d
)
bool
Map3
::
uncutEdge
(
Dart
d
)
{
if
(
phi3
(
d
)
==
d
)
d
=
phi_1
(
phi2
(
d
));
if
(
vertexDegree
(
phi1
(
d
))
==
2
)
{
if
(
phi3
(
d
)
==
d
)
d
=
phi_1
(
phi2
(
d
));
Dart
prev
=
d
;
Dart
dd
=
alpha2
(
d
);
Dart
prev
=
d
;
Dart
dd
=
alpha2
(
d
);
Map2
::
uncutEdge
(
prev
);
Map2
::
uncutEdge
(
prev
);
if
(
phi3
(
dd
)
!=
dd
)
phi3sew
(
dd
,
phi2
(
prev
));
if
(
phi3
(
dd
)
!=
dd
)
phi3sew
(
dd
,
phi2
(
prev
));
while
(
dd
!=
d
)
{
prev
=
dd
;
dd
=
alpha2
(
dd
);
while
(
dd
!=
d
)
{
prev
=
dd
;
dd
=
alpha2
(
dd
);
Map2
::
uncutEdge
(
prev
);
Map2
::
uncutEdge
(
prev
);
phi3sew
(
dd
,
phi2
(
prev
));
phi3sew
(
dd
,
phi2
(
prev
));
}
return
true
;
}
return
false
;
}
bool
Map3
::
deleteVertex
(
Dart
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