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
CGoGN
CGoGN
Commits
0d29d4b5
Commit
0d29d4b5
authored
Nov 07, 2011
by
Pierre Kraemer
Browse files
micro updates
parent
a99355d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Topology/map/map2.h
View file @
0d29d4b5
...
...
@@ -95,6 +95,10 @@ protected:
*/
void
phi2unsew
(
Dart
d
);
/*! @name Boundary marker management
* Function used to merge boundary faces properly
*************************************************************************/
//! merge a face that has been tag as boundary with existing boundary if needed
/* @param d a dart of the face
*/
...
...
@@ -137,32 +141,33 @@ public:
* @param d first dart in vertex v
* @param e second dart in vertex v
*/
virtual
void
splitVertex
(
Dart
d
,
Dart
e
);
// OK boundary
virtual
void
splitVertex
(
Dart
d
,
Dart
e
);
//! Delete the vertex of d (works only for internal vertices)
/*! All the faces around the vertex are merged into one face
/*! Does not create a hole -> all the faces
* around the vertex are merged into one face
* @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
*/
virtual
bool
deleteVertex
(
Dart
d
)
;
// OK boundary
virtual
bool
deleteVertex
(
Dart
d
)
;
//! 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
* @param e second dart in the face
*/
virtual
void
linkVertices
(
Dart
d
,
Dart
e
);
//TODO remov
ing
??
virtual
void
linkVertices
(
Dart
d
,
Dart
e
);
//TODO remov
e
??
//! Cut the edge of d
//! Cut the edge of d
by inserting a new vertex
/*! @param d a dart of the edge to cut
*/
virtual
void
cutEdge
(
Dart
d
);
// OK boundary
virtual
void
cutEdge
(
Dart
d
);
//! 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
bool
uncutEdge
(
Dart
d
);
// OK boundary
virtual
bool
uncutEdge
(
Dart
d
);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
...
...
@@ -188,7 +193,7 @@ public:
* Flip the edge of d (rotation in phi_1 order)
* WARNING : Works only for non-border edges.
* @param d a dart of the edge to flip
* @return true if the flip has been executed, false otherwise
* @return true if the flip
Back
has been executed, false otherwise
*/
virtual
bool
flipBackEdge
(
Dart
d
);
...
...
@@ -207,7 +212,7 @@ public:
virtual
void
removeEdgeFromVertex
(
Dart
d
);
//! Sew two oriented faces along oriented edges
/*! \pre
D
arts d & e MUST be
fixed point of phi2 relation
/*! \pre
Edges of d
arts d & e MUST be
boundary edges
* @param d a dart of the first face
* @param e a dart of the second face
*/
...
...
@@ -402,6 +407,10 @@ public:
bool
foreach_dart_of_link
(
Dart
d
,
unsigned
int
orbit
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//@}
/*! @name Close map after import or creation
* These functions must be used with care, generally only by import algorithms
*************************************************************************/
//@{
//! Close a topological hole (a sequence of connected fixed point of phi2). DO NOT USE, only for import algorithm
/*! \pre dart d MUST be fixed point of phi2 relation
...
...
src/Topology/map/map2.cpp
View file @
0d29d4b5
...
...
@@ -27,8 +27,8 @@
namespace
CGoGN
{
/*! @name
Generato
r an
d Deletor
*
To generate or delete faces in a 2-map
/*! @name
Boundary marke
r
m
an
agement
*
Function used to merge boundary faces properly
*************************************************************************/
void
Map2
::
mergeBoundaryFaces
(
Dart
dd
,
Dart
ee
)
...
...
@@ -94,7 +94,7 @@ void Map2::mergeFaceWithBoundary(Dart d)
storeForLinkVertex
.
pop_back
()
;
Dart
b
=
storeForLinkVertex
.
back
()
;
storeForLinkVertex
.
pop_back
()
;
phi1sew
(
a
,
b
);
phi1sew
(
a
,
b
);
}
//merge by faces
while
(
!
storeForLinkFace
.
empty
())
...
...
@@ -103,10 +103,14 @@ void Map2::mergeFaceWithBoundary(Dart d)
storeForLinkVertex
.
pop_back
()
;
Dart
b
=
storeForLinkVertex
.
back
()
;
storeForLinkVertex
.
pop_back
()
;
mergeBoundaryFaces
(
a
,
b
);
mergeBoundaryFaces
(
a
,
b
);
}
}
/*! @name Generator and Deletor
* To generate or delete faces in a 2-map
*************************************************************************/
void
Map2
::
deleteOrientedFace
(
Dart
d
)
{
// tag face in boundary
...
...
@@ -114,13 +118,6 @@ void Map2::deleteOrientedFace(Dart d)
mergeFaceWithBoundary
(
d
);
}
void
Map2
::
sewOrientedFaces
(
Dart
d
,
Dart
e
)
{
assert
(
phi2
(
d
)
==
d
&&
phi2
(
e
)
==
e
);
// sewing the faces
phi2sew
(
d
,
e
);
}
Dart
Map2
::
newFace
(
unsigned
int
nbEdges
)
{
Dart
d
=
Map1
::
newFace
(
nbEdges
);
...
...
@@ -168,24 +165,12 @@ bool Map2::deleteVertex(Dart d)
void
Map2
::
linkVertices
(
Dart
d
,
Dart
e
)
{
Map1
::
linkVertices
(
d
,
e
);
// Split the face
Map1
::
linkVertices
(
d
,
e
);
// Split the face
phi2sew
(
phi_1
(
d
),
phi_1
(
e
));
// Sew the two resulting faces along the new edge
}
void
Map2
::
cutEdge
(
Dart
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);
// }
Map1
::
cutEdge
(
d
);
// Cut the 1-edge of d
Dart
e
=
phi2
(
d
);
Map1
::
cutEdge
(
e
);
// Cut the 1-edge of phi2(d)
...
...
@@ -201,21 +186,6 @@ void Map2::cutEdge(Dart d)
bool
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) ;
// }
if
(
vertexDegree
(
phi1
(
d
))
==
2
)
{
Dart
ne
=
phi2
(
d
)
;
...
...
@@ -357,30 +327,28 @@ bool Map2::flipBackEdge(Dart d)
void
Map2
::
insertEdgeInVertex
(
Dart
d
,
Dart
e
)
{
assert
(
!
sameVertex
(
d
,
e
)
&&
phi2
(
e
)
==
phi_1
(
e
));
phi1sew
(
phi_1
(
d
),
phi_1
(
e
));
phi1sew
(
phi_1
(
d
),
phi_1
(
e
));
}
void
Map2
::
removeEdgeFromVertex
(
Dart
d
)
{
assert
(
phi2
(
d
)
!=
d
);
phi1sew
(
phi_1
(
d
),
phi2
(
d
));
phi1sew
(
phi_1
(
d
),
phi2
(
d
));
}
void
Map2
::
sewFaces
(
Dart
d
,
Dart
e
)
{
assert
(
isBoundaryFace
(
d
)
&&
isBoundaryFace
(
e
))
;
Dart
dd
=
phi2
(
d
);
Dart
ee
=
phi2
(
e
);
// unsew from boundary
phi2unsew
(
d
);
phi2unsew
(
d
);
// unsew faces from boundary
phi2unsew
(
e
);
// remove boundary edge (could be a Map1::mergeFaces without assert ?)
mergeBoundaryFaces
(
dd
,
ee
);
mergeBoundaryFaces
(
dd
,
ee
);
// remove boundary edge (could be a Map1::mergeFaces without assert ?)
// sewing the faces
phi2sew
(
d
,
e
);
phi2sew
(
d
,
e
);
// sew the faces
}
void
Map2
::
unsewFaces
(
Dart
d
)
...
...
@@ -645,67 +613,6 @@ bool Map2::mergeVolumes(Dart d, Dart e)
return
true
;
}
unsigned
int
Map2
::
closeHole
(
Dart
d
)
{
assert
(
phi2
(
d
)
==
d
);
// Nothing to close
Dart
first
=
newDart
();
// First edge of the face that will fill the hole
unsigned
int
countEdges
=
1
;
phi2sew
(
d
,
first
);
// phi2-link the new edge to the hole
Dart
dNext
=
d
;
// Turn around the hole
Dart
dPhi1
;
// to complete the face
do
{
do
{
dPhi1
=
phi1
(
dNext
);
// Search and put in dNext
dNext
=
phi2
(
dPhi1
);
// the next dart of the hole
}
while
(
dNext
!=
dPhi1
&&
dPhi1
!=
d
);
if
(
dPhi1
!=
d
)
{
Dart
next
=
newDart
();
// Add a new edge there and link it to the face
++
countEdges
;
phi1sew
(
first
,
next
);
// the edge is linked to the face
phi2sew
(
dNext
,
next
);
// the face is linked to the hole
}
}
while
(
dPhi1
!=
d
);
if
(
countEdges
==
2
)
{
countEdges
=
0
;
collapseDegeneratedFace
(
first
);
// if the closing face is 2-sided, collapse it
}
return
countEdges
;
}
//void Map2::closeMap(DartMarker& marker)
//{
// // Search the map for topological holes (fixed point for phi2)
// for (Dart d = begin(); d != end(); next(d))
// {
// if (phi2(d) == d)
// {
// closeHole(d);
// marker.markOrbit(FACE, phi2(d)) ;
// }
// }
//
void
Map2
::
closeMap
()
{
// Search the map for topological holes (fixed point for phi2)
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
{
if
(
phi2
(
d
)
==
d
)
{
closeHole
(
d
);
boundaryMarkOrbit
(
FACE
,
phi2
(
d
));
}
}
}
/*! @name Topological Queries
* Return or set various topological information
*************************************************************************/
...
...
@@ -1074,5 +981,77 @@ bool Map2::foreach_dart_of_link(Dart d, unsigned int orbit, FunctorType& f, unsi
return
false
;
}
/*! @name Close map after import or creation
* These functions must be used with care, generally only by import algorithms
*************************************************************************/
unsigned
int
Map2
::
closeHole
(
Dart
d
)
{
assert
(
phi2
(
d
)
==
d
);
// Nothing to close
Dart
first
=
newDart
();
// First edge of the face that will fill the hole
unsigned
int
countEdges
=
1
;
phi2sew
(
d
,
first
);
// phi2-link the new edge to the hole
Dart
dNext
=
d
;
// Turn around the hole
Dart
dPhi1
;
// to complete the face
do
{
do
{
dPhi1
=
phi1
(
dNext
);
// Search and put in dNext
dNext
=
phi2
(
dPhi1
);
// the next dart of the hole
}
while
(
dNext
!=
dPhi1
&&
dPhi1
!=
d
);
if
(
dPhi1
!=
d
)
{
Dart
next
=
newDart
();
// Add a new edge there and link it to the face
++
countEdges
;
phi1sew
(
first
,
next
);
// the edge is linked to the face
phi2sew
(
dNext
,
next
);
// the face is linked to the hole
}
}
while
(
dPhi1
!=
d
);
if
(
countEdges
==
2
)
{
countEdges
=
0
;
collapseDegeneratedFace
(
first
);
// if the closing face is 2-sided, collapse it
}
return
countEdges
;
}
//void Map2::closeMap(DartMarker& marker)
//{
// // Search the map for topological holes (fixed point for phi2)
// for (Dart d = begin(); d != end(); next(d))
// {
// if (phi2(d) == d)
// {
// closeHole(d);
// marker.markOrbit(FACE, phi2(d)) ;
// }
// }
void
Map2
::
closeMap
()
{
// Search the map for topological holes (fix points of phi2)
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
{
if
(
phi2
(
d
)
==
d
)
{
closeHole
(
d
);
boundaryMarkOrbit
(
FACE
,
phi2
(
d
));
}
}
}
void
Map2
::
sewOrientedFaces
(
Dart
d
,
Dart
e
)
{
assert
(
phi2
(
d
)
==
d
&&
phi2
(
e
)
==
e
);
// sewing the faces
phi2sew
(
d
,
e
);
}
}
// namespace CGoGN
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