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
5e70a78b
Commit
5e70a78b
authored
Nov 30, 2011
by
untereiner
Browse files
Map3 no_boundary : la suite
parent
766d3300
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/Topology/map/embeddedMap3.h
View file @
5e70a78b
...
...
@@ -30,10 +30,8 @@
namespace
CGoGN
{
/**
* Class of 3-dimensional maps
* with managed embeddings
*/
/*! Class of 3-dimensional maps with managed embeddings
*/
class
EmbeddedMap3
:
public
Map3
{
public:
...
...
@@ -81,13 +79,15 @@ public:
*/
virtual
void
splitVolume
(
std
::
vector
<
Dart
>&
vd
);
/**
* No attribute is attached to the new volume
*/
virtual
unsigned
int
closeHole
(
Dart
d
,
bool
forboundary
=
true
);
/*!
*
*/
virtual
bool
check
();
//????????? fonction de 2-carte
virtual
unsigned
int
closeHole
(
Dart
d
);
}
;
}
// namespace CGoGN
...
...
include/Topology/map/map2.h
View file @
5e70a78b
...
...
@@ -377,13 +377,13 @@ public:
*/
bool
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//! Apply a functor on every dart of a edge
//! Apply a functor on every dart of a
n
edge
/*! @param d a dart of the edge
* @param f the functor to apply
*/
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//! Apply a functor on every dart of a volume
//! Apply a functor on every dart of a
n oriented
volume
/*! @param d a dart of the volume
* @param f the functor to apply
*/
...
...
@@ -393,7 +393,6 @@ public:
/*! @param d a dart of the volume
* @param f the functor to apply
*/
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//! Apply a functor on every dart of a connected component
...
...
include/Topology/map/map2.hpp
View file @
5e70a78b
...
...
@@ -135,6 +135,11 @@ inline bool Map2::sameEdge(Dart d, Dart e)
return
d
==
e
||
phi2
(
d
)
==
e
;
}
inline
bool
Map2
::
isBoundaryEdge
(
Dart
d
)
{
return
isBoundaryMarked
(
d
)
||
isBoundaryMarked
(
phi2
(
d
));
}
inline
bool
Map2
::
sameOrientedFace
(
Dart
d
,
Dart
e
)
{
return
Map1
::
sameCycle
(
d
,
e
)
;
...
...
include/Topology/map/map3.h
View file @
5e70a78b
...
...
@@ -123,7 +123,6 @@ public:
*************************************************************************/
//@{
//TODO deleteVertex : works only for boundary vertices
//! Delete the vertex of d
/*! All the faces around the vertex are merged into one face
* @param d a dart of the vertex to delete
...
...
@@ -171,7 +170,6 @@ public:
/*! @param vd a vector of darts
*/
virtual
void
splitVolume
(
std
::
vector
<
Dart
>&
vd
);
//@}
/*! @name Topological Queries
...
...
@@ -179,12 +177,6 @@ public:
*************************************************************************/
//@{
//! Test if dart d and e belong to the same oriented vertex
/*! @param d a dart
* @param e a dart
*/
bool
sameOrientedVertex
(
Dart
d
,
Dart
e
)
;
//! Test if dart d and e belong to the same vertex
/*! @param d a dart
* @param e a dart
...
...
@@ -223,6 +215,12 @@ public:
*/
bool
isBoundaryEdge
(
Dart
d
)
;
/**
* find the dart of edge that belong to the boundary
* return NIL if the edge is not on the boundary
*/
Dart
findBoundaryFaceOfEdge
(
Dart
d
);
//! Test if dart d and e belong to the same oriented face
/*! @param d a dart
* @param e a dart
...
...
@@ -248,12 +246,6 @@ public:
*************************************************************************/
//@{
//! Apply a functor on each dart of a vertex
/*! @param d a dart of the vertex
* @param fonct the functor
*/
bool
foreach_dart_of_oriented_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//! Apply a functor on each dart of a vertex
/*! @param d a dart of the vertex
* @param fonct the functor
...
...
@@ -266,24 +258,12 @@ public:
*/
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
bool
foreach_dart_of_open_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//! Apply a functor on each dart of an oriented face
/*! @param d a dart of the oriented face
* @param fonct the functor
*/
bool
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
// TODO change to oriented volume to handle higher dimension ?
//! Apply a functor on each dart of an volume
/*! @param d a dart of the volume
* @param fonct the functor
*/
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
{
return
foreach_dart_of_oriented_volume
(
d
,
f
);
}
//! Apply a functor on each dart of a cc
/*! @param d a dart of the cc
* @param fonct the functor
...
...
@@ -291,6 +271,26 @@ public:
bool
foreach_dart_of_cc
(
Dart
d
,
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 phi3). DO NOT USE, only for import/creation algorithm
/*! \pre dart d MUST be fixed point of phi3 relation
* Add a volume to the map that closes the hole.
* @param d a dart of the hole (with phi3(d)==d)
* @param forboundary tag the created face as boundary (default is true)
* @return the degree of the created volume
*/
virtual
unsigned
int
closeHole
(
Dart
d
,
bool
forboundary
=
true
);
//! Close the map removing topological holes: DO NOT USE, only for import/creation algorithm
/*! Add volumes to the map that close every existing hole.
* These faces are marked as boundary.
*/
void
closeMap
();
//@}
};
}
// namespace CGoGN
...
...
include/Topology/map/map3.hpp
View file @
5e70a78b
...
...
@@ -30,8 +30,6 @@
namespace
CGoGN
{
/// INLINE FUNCTIONS
inline
void
Map3
::
init
()
{
m_phi3
=
addRelation
(
"phi3"
)
;
...
...
@@ -98,17 +96,11 @@ inline Dart Map3::phi(Dart d)
}
}
/*
* N'a pas de sens dans une 3-carte, n'est pas une permutation
*/
inline
Dart
Map3
::
alpha0
(
Dart
d
)
{
return
phi3
(
d
)
;
}
/*
* idem
*/
inline
Dart
Map3
::
alpha1
(
Dart
d
)
{
return
phi_1
(
phi3
(
d
))
;
...
...
@@ -119,46 +111,11 @@ inline Dart Map3::alpha2(Dart d)
return
phi3
(
phi2
(
d
));
}
//inline Dart Map3::alpha2(Dart d)
//{
// Dart e = phi2(d);
// Dart f = phi3(e);
//
// if (f != e)
// return f;
//
// f = d;
// e = phi3(f);
// while (e != f)
// {
// f = phi2(e);
// e = phi3(f);
// }
// return f;
//}
inline
Dart
Map3
::
alpha_2
(
Dart
d
)
{
return
phi2
(
phi3
(
d
));
}
//inline Dart Map3::alpha_2(Dart d)
//{
// Dart e = phi3(d);
//
// if (e != d)
// return phi2(e);
//
// e = d;
// Dart f = phi2(d);
// while (phi3(f) != f)
// {
// e = phi3(f);
// f = phi2(e);
// }
// return e;
//}
inline
void
Map3
::
phi3sew
(
Dart
d
,
Dart
e
)
{
assert
((
*
m_phi3
)[
d
.
index
]
==
d
)
;
...
...
@@ -174,51 +131,32 @@ inline void Map3::phi3unsew(Dart d)
(
*
m_phi3
)[
e
.
index
]
=
e
;
}
inline
bool
Map3
::
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
return
foreach_dart_of_oriented_vertex
(
d
,
f
,
thread
);
}
//template<typename TMAP>
//bool Map3::foreach_dart_of_parent_cell(int dim, Dart d, FunctorType& f)
//{
// switch(dim)
// {
// case 0: return this->TMAP::foreach_dart_of_vertex(d,f);
// case 1: return this->TMAP::foreach_dart_of_edge(d,f);
// case 2: return this->TMAP::foreach_dart_of_face(d,f);
// case -1: return this->TMAP::foreach_dart_of_cc(d,f);
// }
// return false;
//}
//
//template<typename TMAP>
//bool Map3::markOrbitOf(int dim, Dart d, Marker m)
//{
// FunctorMark<Map3> fmark(*this, m);
// switch(dim)
// {
// case 0: return this->TMAP::foreach_dart_of_vertex(d,fmark);
// case 1: return this->TMAP::foreach_dart_of_edge(d,fmark);
// case 2: return this->TMAP::foreach_dart_of_face(d,fmark);
// case -1: return this->TMAP::foreach_dart_of_cc(d,fmark);
// }
// return false;
//}
//
//template<typename TMAP>
//bool Map3::unmarkOrbitOf(int dim, Dart d, Marker m)
//{
// FunctorUnmark<Map3> fumark(*this, m);
// switch(dim)
// {
// case 0: return this->TMAP::foreach_dart_of_vertex(d,fumark);
// case 1: return this->TMAP::foreach_dart_of_edge(d,fumark);
// case 2: return this->TMAP::foreach_dart_of_face(d,fumark);
// case -1: return this->TMAP::foreach_dart_of_cc(d,fumark);
// }
// return false;
//}
/*! @name Topological Queries
* Return or set various topological information
*************************************************************************/
}
// namespace CGoGN
inline
bool
Map3
::
sameEdge
(
Dart
d
,
Dart
e
)
{
return
sameOrientedEdge
(
d
,
e
)
||
sameOrientedEdge
(
phi2
(
d
),
e
)
;
}
inline
bool
Map3
::
sameFace
(
Dart
d
,
Dart
e
)
{
return
Map2
::
sameOrientedFace
(
d
,
e
)
||
Map2
::
sameOrientedFace
(
phi3
(
d
),
e
)
;
}
inline
bool
Map3
::
isBoundaryFace
(
Dart
d
)
{
return
isBoundaryMarked
(
d
)
||
isBoundaryMarked
(
phi3
(
d
));
}
/*! @name Cell Functors
* Apply functors to all darts of a cell
*************************************************************************/
inline
bool
Map3
::
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
return
Map2
::
foreach_dart_of_oriented_face
(
d
,
f
,
thread
)
||
Map2
::
foreach_dart_of_oriented_face
(
phi3
(
d
),
f
,
thread
);
}
}
// namespace CGoGN
src/Topology/map/embeddedMap3.cpp
View file @
5e70a78b
...
...
@@ -22,9 +22,6 @@
* *
*******************************************************************************/
#include
<vector>
#include
<algorithm>
#include
"Topology/map/embeddedMap3.h"
namespace
CGoGN
...
...
@@ -310,26 +307,4 @@ bool EmbeddedMap3::check()
return
true
;
}
unsigned
int
EmbeddedMap3
::
closeHole
(
Dart
d
)
{
unsigned
int
nbE
=
Map3
::
closeHole
(
d
);
Dart
dd
=
phi2
(
d
);
Dart
f
=
dd
;
do
{
if
(
isOrbitEmbedded
(
VERTEX
))
copyDartEmbedding
(
VERTEX
,
f
,
phi1
(
phi2
(
f
)));
if
(
isOrbitEmbedded
(
EDGE
))
copyDartEmbedding
(
EDGE
,
f
,
phi2
(
f
));
if
(
isOrbitEmbedded
(
VOLUME
))
copyDartEmbedding
(
VOLUME
,
f
,
phi2
(
f
));
f
=
phi1
(
f
);
}
while
(
dd
!=
f
);
return
nbE
;
}
}
// namespace CGoGN
src/Topology/map/map2.cpp
View file @
5e70a78b
...
...
@@ -352,17 +352,13 @@ void Map2::unsewFaces(Dart d)
Dart
e
=
newBoundaryCycle
(
2
);
Dart
ee
=
phi1
(
e
)
;
if
(
isBoundaryVertex
(
d
))
{
Dart
f
=
findBoundaryEdgeOfVertex
(
d
);
Dart
f
=
findBoundaryEdgeOfVertex
(
d
);
if
(
f
!=
NIL
)
phi1sew
(
e
,
phi_1
(
f
));
}
if
(
isBoundaryVertex
(
dd
))
{
Dart
f
=
findBoundaryEdgeOfVertex
(
dd
);
f
=
findBoundaryEdgeOfVertex
(
dd
);
if
(
f
!=
NIL
)
phi1sew
(
ee
,
phi_1
(
f
));
}
phi2unsew
(
d
);
...
...
@@ -575,12 +571,6 @@ Dart Map2::findBoundaryEdgeOfVertex(Dart d)
return
NIL
;
}
bool
Map2
::
isBoundaryEdge
(
Dart
d
)
{
Dart
e
=
phi2
(
d
);
return
isBoundaryMarked
(
e
)
||
isBoundaryMarked
(
d
);
}
bool
Map2
::
isBoundaryFace
(
Dart
d
)
{
Dart
it
=
d
;
...
...
@@ -745,31 +735,31 @@ bool Map2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int
DartMarkerStore
mark
(
*
this
,
thread
);
// Lock a marker
bool
found
=
false
;
// Last functor return value
std
::
list
<
Dart
>
visitedFaces
;
// Faces that are traversed
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
1024
)
;
visitedFaces
.
push_back
(
d
);
// Start with the face of d
std
::
list
<
Dart
>::
iterator
face
;
// For every face added to the list
for
(
face
=
visitedFaces
.
begin
();
!
found
&&
face
!=
visitedFaces
.
end
();
++
face
)
for
(
std
::
vector
<
Dart
>::
iterator
it
=
visitedFaces
.
begin
();
!
found
&&
it
!=
visitedFaces
.
end
();
++
it
)
{
if
(
!
isBoundaryMarked
(
*
face
)
&&
!
mark
.
isMarked
(
*
face
))
// Face has not been visited yet
if
(
!
isBoundaryMarked
(
*
it
)
&&
!
mark
.
isMarked
(
*
it
))
// Face has not been visited yet
{
// Apply functor to the darts of the face
found
=
foreach_dart_of_oriented_face
(
*
face
,
f
);
found
=
foreach_dart_of_oriented_face
(
*
it
,
f
);
// If functor returns false then mark visited darts (current face)
// and add non visited adjacent faces to the list of face
if
(
!
found
)
{
Dart
it
=
*
face
;
Dart
e
=
*
it
;
do
{
mark
.
mark
(
it
);
// Mark
Dart
adj
=
phi2
(
it
);
// Get adjacent face
mark
.
mark
(
e
);
// Mark
Dart
adj
=
phi2
(
e
);
// Get adjacent face
if
(
!
isBoundaryMarked
(
adj
)
&&
!
mark
.
isMarked
(
adj
))
visitedFaces
.
push_back
(
adj
);
// Add it
it
=
phi1
(
it
);
}
while
(
it
!=
*
face
);
e
=
phi1
(
e
);
}
while
(
e
!=
*
it
);
}
}
}
...
...
@@ -808,16 +798,8 @@ unsigned int Map2::closeHole(Dart d, bool forboundary)
}
}
while
(
dPhi1
!=
d
);
if
(
countEdges
<
3
)
{
countEdges
=
0
;
collapseDegeneratedFace
(
first
);
// if the closing face is 2-sided, collapse it
}
else
{
if
(
forboundary
)
boundaryMarkOrbit
(
FACE
,
phi2
(
d
));
}
if
(
forboundary
)
boundaryMarkOrbit
(
FACE
,
phi2
(
d
));
return
countEdges
;
}
...
...
src/Topology/map/map3.cpp
View file @
5e70a78b
...
...
@@ -238,12 +238,40 @@ void Map3::sewVolumes(Dart d, Dart e, bool withBoundary)
void
Map3
::
unsewVolumes
(
Dart
d
)
{
Dart
fitD
=
d
;
assert
(
!
isBoundaryFace
(
d
))
;
unsigned
int
nbE
=
faceDegree
(
d
)
;
Dart
d3
=
phi3
(
d
);
Dart
b1
=
newBoundaryCycle
(
nbE
)
;
Dart
b2
=
newBoundaryCycle
(
nbE
)
;
Dart
fit1
=
d
;
Dart
fit2
=
d3
;
Dart
fitB1
=
b1
;
Dart
fitB2
=
b2
;
do
{
phi3unsew
(
fitD
);
fitD
=
phi1
(
fitD
);
}
while
(
fitD
!=
d
);
Dart
f
=
findBoundaryFaceOfEdge
(
fit1
)
;
if
(
f
!=
NIL
)
{
Dart
f2
=
phi2
(
f
)
;
phi2unsew
(
f
)
;
phi2sew
(
fitB1
,
f
)
;
phi2sew
(
fitB2
,
f2
)
;
}
else
phi2sew
(
fitB1
,
fitB2
)
;
phi3unsew
(
fit1
)
;
phi3sew
(
fit1
,
fitB1
)
;
phi3sew
(
fit2
,
fitB2
)
;
fit1
=
phi1
(
fit1
)
;
fit2
=
phi_1
(
fit2
)
;
fitB1
=
phi_1
(
fitB1
)
;
fitB2
=
phi1
(
fitB2
)
;
}
while
(
fitB1
!=
b1
)
;
}
bool
Map3
::
mergeVolumes
(
Dart
d
)
...
...
@@ -251,7 +279,6 @@ bool Map3::mergeVolumes(Dart d)
if
(
!
isBoundaryFace
(
d
))
{
Dart
e
=
phi3
(
d
);
Map3
::
unsewVolumes
(
d
);
//TODO a enlever ??
Map2
::
mergeVolumes
(
d
,
e
);
// merge the two volumes along common face
return
true
;
}
...
...
@@ -267,59 +294,47 @@ void Map3::splitVolume(std::vector<Dart>& vd)
for
(
std
::
vector
<
Dart
>::
iterator
it
=
vd
.
begin
()
;
it
!=
vd
.
end
()
;
++
it
)
Map2
::
unsewFaces
(
*
it
);
//close the two holes
Map2
::
closeHole
(
e
);
Map2
::
closeHole
(
e2
);
Map2
::
fillHole
(
e
)
;
Map2
::
fillHole
(
e2
)
;
//sew the two conne
xe
compon
n
ents
Map3
::
sewVolumes
(
phi2
(
e
),
phi2
(
e2
));
//sew the two conne
cted
components
Map3
::
sewVolumes
(
phi2
(
e
),
phi2
(
e2
)
,
false
);
}
/*! @name Topological Queries
* Return or set various topological information
*************************************************************************/
bool
Map3
::
sameOrientedVertex
(
Dart
d
,
Dart
e
)
{
return
sameVertex
(
d
,
e
);
}
bool
Map3
::
sameVertex
(
Dart
d
,
Dart
e
)
{
DartMarkerStore
mv
(
*
this
);
// Lock a marker
std
::
list
<
Dart
>
darts_list
;
//Darts that are traversed
darts_list
.
push_back
(
d
);
//Start with the dart d
std
::
vector
<
Dart
>
darts
;
// Darts that are traversed
darts
.
reserve
(
256
);
darts
.
push_back
(
d
);
// Start with the dart d
mv
.
mark
(
d
);
for
(
std
::
list
<
Dart
>::
iterator
darts
=
darts
_list
.
begin
();
darts
!=
darts
_list
.
end
()
;
++
darts
)
for
(
std
::
vector
<
Dart
>::
iterator
it
=
darts
.
begin
();
it
!=
darts
.
end
()
;
++
it
)
{
Dart
dc
=
*
darts
;
if
(
dc
==
e
)
if
(
*
it
==
e
)
return
true
;
//add phi21 and phi23 successor if they are not marked yet
Dart
d2
=
phi2
(
dc
);
if
(
d2
!=
dc
)
{
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
if
(
!
mv
.
isMarked
(
d21
))
{
darts_list
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
Dart
d2
=
phi2
(
*
it
);
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
if
((
d23
!=
d2
)
&&
!
mv
.
isMarked
(
d23
))
{
darts_list
.
push_back
(
d23
);
mv
.
mark
(
d23
);
}
if
(
!
mv
.
isMarked
(
d21
))
{
darts
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
if
(
!
mv
.
isMarked
(
d23
))
{
darts
.
push_back
(
d23
);
mv
.
mark
(
d23
);
}
}
return
false
;
}
...
...
@@ -328,42 +343,37 @@ unsigned int Map3::vertexDegree(Dart d)
unsigned
int
count
=
0
;
DartMarkerStore
mv
(
*
this
);
// Lock a marker
std
::
list
<
Dart
>
darts_list
;
//Darts that are traversed
darts_list
.
push_back
(
d
);
//Start with the dart d
std
::
list
<
Dart
>::
iterator
darts
;
std
::
vector
<
Dart
>
darts
;
// Darts that are traversed
darts
.
reserve
(
256
);
darts
.
push_back
(
d
);
// Start with the dart d
mv
.
mark
(
d
);
for
(
darts
=
darts
_list
.
begin
();
darts
!=
darts
_list
.
end
()
;
++
darts
)
for
(
std
::
vector
<
Dart
>::
iterator
it
=
darts
.
begin
();
it
!=
darts
.
end
()
;
++
it
)
{
Dart
dc
=
*
darts
;
//add phi21 and phi23 successor if they are not marked yet
Dart
d2
=
phi2
(
dc
);
Dart
d2
=
phi2
(
*
it
);
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
if
(
!
mv
.
isMarked
(
d21
))
{
darts
_list
.
push_back
(
d21
);
darts
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
if
((
d23
!=
d2
)
&&
!
mv
.
isMarked
(
d23
))
if
(
!
mv
.
isMarked
(
d23
))
{
darts
_list
.
push_back
(
d23
);
darts
.
push_back
(
d23
);