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
109b3a6b
Commit
109b3a6b
authored
Oct 31, 2011
by
Sylvain Thery
Browse files
la suite
parent
67f9658c
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Topology/map/map1.hpp
View file @
109b3a6b
...
...
@@ -153,6 +153,9 @@ inline void Map1::cutEdge(Dart d)
{
Dart
e
=
newDart
()
;
// Create a new dart
phi1sew
(
d
,
e
)
;
// Insert dart e between d and phi1(d)
if
(
isBoundaryMarked
(
d
))
boundaryMark
(
e
);
}
inline
void
Map1
::
collapseEdge
(
Dart
d
)
...
...
include/Topology/map/map2.h
View file @
109b3a6b
...
...
@@ -112,7 +112,7 @@ protected:
/*! The phi2-links around the face are removed
* @param d a dart of the face
*/
void
deleteOrientedFace
(
Dart
d
)
;
void
deleteOrientedFace
(
Dart
d
)
;
// OK boundary
public:
virtual
void
deleteFace
(
Dart
d
)
;
...
...
@@ -128,7 +128,7 @@ public:
* @param d first dart in vertex v
* @param e second dart in vertex v
*/
virtual
void
splitVertex
(
Dart
d
,
Dart
e
);
//
TODO modification for new boundary managing method
virtual
void
splitVertex
(
Dart
d
,
Dart
e
);
//
OK boundary
//! Delete the vertex of d (works only for internal vertices)
...
...
@@ -136,7 +136,7 @@ public:
* @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
*/
virtual
bool
deleteVertex
(
Dart
d
)
;
//
TODO modification for new boundary managing method
virtual
bool
deleteVertex
(
Dart
d
)
;
//
OK boundary
//! Link two vertices belonging to distinct faces (add an edge between the two vertices)
...
...
@@ -150,13 +150,13 @@ public:
//! Cut the edge of d and its opposite edge if it exists
/*! @param d a dart of the edge to cut
*/
virtual
void
cutEdge
(
Dart
d
);
//
TODO modification for new boundary managing method
virtual
void
cutEdge
(
Dart
d
);
//
OK boundary
//! Undo the cut of the edge of d and its opposite edge if it exists
/*! @param d a dart of the edge to uncut
*/
virtual
void
uncutEdge
(
Dart
d
);
//
TODO modification for new boundary managing method
virtual
void
uncutEdge
(
Dart
d
);
//
OK boundary
//! Collapse an edge (that is deleted) possibly merging its vertices
...
...
@@ -169,7 +169,7 @@ public:
* @param delDegenerateFaces a boolean (default to true)
* @return a dart of the resulting vertex
*/
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
);
//TODO
modification for new boundary managing method
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
);
//TODO
close degenerated boundary ???
/**
...
...
@@ -246,7 +246,7 @@ public:
* Extract a pair of sewed triangles and sew their adjacent faces
* d is a dart of the common edge of the pair of triangles
*/
void
extractTrianglePair
(
Dart
d
)
;
//TODO modification for new boundary managing method
void
extractTrianglePair
(
Dart
d
)
;
/**
...
...
@@ -254,7 +254,7 @@ public:
* v1 and v2 belong to the same vertex
* d is a dart of the common edge of the pair of triangles
*/
void
insertTrianglePair
(
Dart
d
,
Dart
v1
,
Dart
v2
)
;
//TODO modification for new boundary managing method
void
insertTrianglePair
(
Dart
d
,
Dart
v1
,
Dart
v2
)
;
/**
...
...
@@ -266,7 +266,7 @@ public:
/**
* Unse
x
the Umbrella aroud a vertex, close the hole and then
* Unse
w
the Umbrella aroud a vertex, close the hole and then
* create a symetric to construct a polyedron
* @param d a dart from the vertex
*/
...
...
@@ -337,14 +337,14 @@ public:
/**
* tell if the vertex of d is on the boundary of the map
*/
bool
isBoundaryVertex
(
Dart
d
)
;
bool
isBoundaryVertex
(
Dart
d
)
;
// OK boundary
//! Follow the boundary of a surface as if it was a oriented face.
/*! This operation alternate phi1 and phi2 operator until another
* boudary dart is reached.
* @param d a boundary dart
*/
Dart
nextOnBoundary
(
Dart
d
);
Dart
nextOnBoundary
(
Dart
d
);
// OK boundary
// TODO a mettre en algo
/**
...
...
src/Topology/map/map2.cpp
View file @
109b3a6b
...
...
@@ -46,7 +46,7 @@ void Map2::mergeFacewithBoundary(Dart d)
Dart
ee
=
phi_1
(
e
);
if
(
f
!=
ee
)
phi1sew
(
f
,
ee
)
;
deleteOrientedFace
(
e
)
;
Map1
::
deleteOrientedFace
(
e
)
;
}
e
=
phi1
(
e
)
;
}
while
(
e
!=
d
)
;
...
...
@@ -100,45 +100,133 @@ void Map2::linkVertices(Dart d, Dart e)
void
Map2
::
cutEdge
(
Dart
d
)
{
Map1
::
cutEdge
(
d
);
// Cut the edge of d
Dart
nd
=
phi1
(
d
);
// Map1::cutEdge(d); // Cut the edge of d
// Dart nd = phi1(d);
// Dart e = phi2(d);
// if (e != d) // Test if an opposite edge exists
// {
// Map1::cutEdge(e); // Cut the opposite edge
// Dart ne = phi1(e);
// phi2unsew(d); // Correct the phi2 links
// phi2sew(d, ne);
// phi2sew(e, nd);
// }
// TODISCUSS: it is not allowed to cut an edge of boundary
assert
(
!
isBoundaryMarked
(
d
));
Map1
::
cutEdge
(
d
);
// Cut the 1-edge of d
Dart
e
=
phi2
(
d
);
if
(
e
!=
d
)
// Test if an opposite edge exists
{
Map1
::
cutEdge
(
e
);
// Cut the opposite edge
Dart
ne
=
phi1
(
e
);
phi2unsew
(
d
);
// Correct the phi2 links
phi2sew
(
d
,
ne
);
phi2sew
(
e
,
nd
);
}
Map1
::
cutEdge
(
e
);
// Cut the 1-edge of phi2(d)
phi2unsew
(
d
);
// remove old phi2 links
Dart
nd
=
phi1
(
d
);
Dart
ne
=
phi1
(
e
);
phi2sew
(
d
,
ne
);
// Correct the phi2 links
phi2sew
(
e
,
nd
);
if
(
isBoundaryMarked
(
e
))
boundaryMark
(
ne
);
// if (isBoundaryMarked(d))
// boundaryMark(nd);
}
void
Map2
::
uncutEdge
(
Dart
d
)
{
// assert(vertexDegree(phi1(d)) == 2) ;
// Dart ne = phi2(d) ;
// if(ne == d)
// collapseEdge(d) ;
// else
// {
// Dart nd = phi1(d) ;
// Dart e = phi_1(ne) ;
// phi2unsew(e) ;
// phi2unsew(d) ;
// Map1::collapseEdge(nd) ;
// Map1::collapseEdge(ne) ;
// phi2sew(d, e) ;
// }
assert
(
vertexDegree
(
phi1
(
d
))
==
2
)
;
Dart
ne
=
phi2
(
d
)
;
if
(
ne
==
d
)
collapseEdge
(
d
)
;
else
{
Dart
nd
=
phi1
(
d
)
;
Dart
e
=
phi_1
(
ne
)
;
phi2unsew
(
e
)
;
phi2unsew
(
d
)
;
Map1
::
collapseEdge
(
nd
)
;
Map1
::
collapseEdge
(
ne
)
;
phi2sew
(
d
,
e
)
;
}
Dart
nd
=
phi1
(
d
)
;
Dart
e
=
phi_1
(
ne
)
;
phi2unsew
(
e
)
;
phi2unsew
(
d
)
;
Map1
::
collapseEdge
(
nd
)
;
Map1
::
collapseEdge
(
ne
)
;
phi2sew
(
d
,
e
)
;
}
Dart
Map2
::
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
)
{
Dart
resV
;
// Dart resV ;
//
// Dart e = phi2(d);
// if (e != d) // Test if an opposite edge exists
// {
// phi2unsew(d); // Unlink the opposite edges
// Dart f = phi1(e) ;
// Dart g = phi_1(e) ;
//
// if(f != d && !isFaceTriangle(e))
// resV = f ;
// else if(phi2(g) != g)
// resV = phi2(g) ;
// else if(f != d && phi2(f) != f)
// resV = phi1(phi2(f)) ;
//
// if (f != e && delDegenerateFaces)
// {
// Map1::collapseEdge(e) ; // Collapse edge e
// collapseDegeneratedFace(f) ;// and collapse its face if degenerated
// }
// else
// Map1::collapseEdge(e) ; // Just collapse edge e
// }
//
// Dart f = phi1(d) ;
// Dart g = phi_1(d) ;
//
// if(resV == Dart::nil())
// {
// if(!isFaceTriangle(d))
// resV = f ;
// else if(phi2(g) != g)
// resV = phi2(g) ;
// else if(phi2(f) != f)
// resV = phi1(phi2(f)) ;
// }
//
// if (f != d && delDegenerateFaces)
// {
// Map1::collapseEdge(d) ; // Collapse edge d
// collapseDegeneratedFace(f) ;// and collapse its face if degenerated
// }
// else
// Map1::collapseEdge(d) ; // Just collapse edge d
//
// return resV ;
Dart
resV
=
Dart
::
nil
()
;
Dart
e
=
phi2
(
d
);
if
(
e
!=
d
)
// Test if an opposite edge exists
phi2unsew
(
d
);
// Unlink the opposite edges
if
(
isBoundaryMarked
(
e
))
{
Dart
f
=
phi1
(
e
)
;
Map1
::
collapseEdge
(
e
)
;
// Collapse edge e
collapseDegeneratedFace
(
f
)
;
// and collapse its face if degenerated
}
else
{
phi2unsew
(
d
);
// Unlink the opposite edges
Dart
f
=
phi1
(
e
)
;
Dart
g
=
phi_1
(
e
)
;
...
...
@@ -184,8 +272,8 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
bool
Map2
::
flipEdge
(
Dart
d
)
{
Dart
e
=
phi2
(
d
);
// Test if an opposite
if
(
e
!=
d
)
// edge exists
Dart
e
=
phi2
(
d
);
// Test if an opposite
if
(
!
isBoundaryMarked
(
e
))
// edge exists
{
Dart
dNext
=
phi1
(
d
);
Dart
eNext
=
phi1
(
e
);
...
...
@@ -202,8 +290,8 @@ bool Map2::flipEdge(Dart d)
bool
Map2
::
flipBackEdge
(
Dart
d
)
{
Dart
e
=
phi2
(
d
);
// Test if an opposite
if
(
e
!=
d
)
// edge exists
Dart
e
=
phi2
(
d
);
// Test if an opposite
if
(
!
isBoundaryMarked
(
e
))
// edge exists
{
Dart
dNext
=
phi1
(
d
);
Dart
eNext
=
phi1
(
e
);
...
...
@@ -234,11 +322,26 @@ void Map2::removeEdgeFromVertex(Dart d)
void
Map2
::
sewFaces
(
Dart
d
,
Dart
e
)
{
Dart
dd
=
phi2
(
d
);
Dart
ee
=
phi2
(
ee
);
// unsew from boundary
phi2unsew
(
d
);
phi2unsew
(
e
);
// remove boundary edge
if
(
ee
!=
phi_1
(
dd
))
phi1sew
(
ee
,
phi_1
(
dd
))
;
if
(
ee
!=
phi_1
(
dd
))
phi1sew
(
ee
,
phi_1
(
dd
))
;
Map1
::
deleteOrientedFace
(
d
)
;
// main sewing
phi2sew
(
d
,
e
);
}
void
Map2
::
unsewFaces
(
Dart
d
)
{
// TODO
phi2unsew
(
d
);
}
...
...
@@ -268,7 +371,7 @@ void Map2::splitFace(Dart d, Dart e)
bool
Map2
::
mergeFaces
(
Dart
d
)
{
Dart
e
=
phi2
(
d
)
;
if
(
e
!=
d
)
if
(
!
isBoundaryMarked
(
e
)
)
{
phi2unsew
(
d
);
// unsew the face of d
Map1
::
mergeFaces
(
d
,
e
);
// merge the two faces along edges of d and e
...
...
@@ -281,7 +384,7 @@ void Map2::extractTrianglePair(Dart d)
{
assert
(
isFaceTriangle
(
d
))
;
Dart
e
=
phi2
(
d
)
;
if
(
e
!=
d
)
if
(
!
isBoundaryMarked
(
e
)
)
{
assert
(
isFaceTriangle
(
e
))
;
Dart
e1
=
phi2
(
phi1
(
e
))
;
...
...
@@ -300,12 +403,12 @@ void Map2::extractTrianglePair(Dart d)
void
Map2
::
insertTrianglePair
(
Dart
d
,
Dart
v1
,
Dart
v2
)
{
assert
(
sameOrientedVertex
(
v1
,
v2
))
;
assert
((
v1
!=
v2
&&
phi2
(
d
)
!=
d
)
||
(
v1
==
v2
&&
phi2
(
d
)
==
d
))
;
assert
(
isFaceTriangle
(
d
)
&&
phi2
(
phi1
(
d
))
==
phi1
(
d
)
&&
phi2
(
phi_1
(
d
))
==
phi_1
(
d
)
)
;
assert
((
v1
!=
v2
&&
!
isBoundaryMarked
(
d
))
||
(
v1
==
v2
&&
isBoundaryMarked
(
d
)
))
;
assert
(
isFaceTriangle
(
d
)
&&
isBoundaryMarked
(
phi1
(
d
))
&&
isBoundaryMarked
(
phi_1
(
d
))
)
;
Dart
e
=
phi2
(
d
)
;
if
(
e
!
=
d
&&
v1
!=
v2
)
if
(
!
isBoundaryMarked
(
e
)
&&
v1
!=
v2
)
{
assert
(
isFaceTriangle
(
e
)
&&
phi2
(
phi1
(
e
))
==
phi1
(
e
)
&&
phi2
(
phi_1
(
e
))
==
phi_1
(
e
)
)
;
assert
(
isFaceTriangle
(
e
)
&&
isBoundaryMarked
(
phi1
(
e
))
&&
isBoundaryMarked
(
phi_1
(
e
))
)
;
Dart
vv2
=
phi2
(
v2
)
;
phi2unsew
(
v2
)
;
phi2sew
(
phi_1
(
e
),
v2
)
;
...
...
@@ -508,27 +611,47 @@ 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
{
if
(
phi2
(
dNext
)
==
dNext
)
if
(
isBoundaryMarked
(
phi2
(
dNext
)
)
)
return
true
;
dNext
=
alpha1
(
dNext
)
;
}
while
(
dNext
!=
d
)
;
return
false
;
}
Dart
Map2
::
nextOnBoundary
(
Dart
d
)
{
assert
(
phi2
(
d
)
==
d
);
// Only work on boundary dart
// assert(phi2(d) == d); // Only work on boundary dart
// Dart dPhi1;
// Dart dNext = d;
// do
// { // Loop inside the vertex
// dPhi1 = phi1(dNext);
// dNext = phi2(dPhi1);
// } while (dNext != dPhi1);
// return dNext;
assert
(
isBoundaryMarked
(
phi2
(
d
))
);
// Only work on boundary dart
Dart
dPhi1
;
Dart
dNext
=
d
;
do
{
// Loop inside the vertex
dPhi1
=
phi1
(
dNext
);
dNext
=
phi2
(
dPhi1
);
}
while
(
dNext
!=
dPhi1
);
return
d
Next
;
}
while
(
!
isBoundaryMarked
(
dNext
)
);
return
d
Phi1
;
}
bool
Map2
::
isTriangular
()
...
...
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