Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
b9fb2856
Commit
b9fb2856
authored
Mar 14, 2014
by
CGoGN
Browse files
Options
Browse Files
Download
Plain Diff
Merge /home/thery/CGoGN
parents
c052557b
7247415b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
316 additions
and
17 deletions
+316
-17
include/Algo/Topo/Map2/uniformOrientation.h
include/Algo/Topo/Map2/uniformOrientation.h
+54
-0
include/Algo/Topo/Map2/uniformOrientation.hpp
include/Algo/Topo/Map2/uniformOrientation.hpp
+217
-0
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+22
-7
include/Topology/generic/traversorCell.h
include/Topology/generic/traversorCell.h
+13
-0
include/Topology/generic/traversorCellVirt.h
include/Topology/generic/traversorCellVirt.h
+8
-8
include/Topology/generic/traversorCellVirt.hpp
include/Topology/generic/traversorCellVirt.hpp
+2
-2
No files found.
include/Algo/Topo/Map2/uniformOrientation.h
0 → 100644
View file @
b9fb2856
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __UNIFORM_ORIENTATION__
#define __UNIFORM_ORIENTATION__
namespace
CGoGN
{
namespace
Algo
{
namespace
Topo
{
/**
* @brief Restore an uniform orientation on a mesh that has been imported from set of triangle with non uniform orientation
* @param map a Map2 or inherited
* @param faceSeed a dart of a face of the CC to process.
*/
template
<
typename
MAP
>
void
uniformOrientationCC
(
MAP
&
map
,
Dart
faceSeed
);
}
// namespace Topo
}
// namespace Algo
}
// namespace CGoGN
#include "uniformOrientation.hpp"
#endif
include/Algo/Topo/Map2/uniformOrientation.hpp
0 → 100644
View file @
b9fb2856
namespace
CGoGN
{
namespace
Algo
{
namespace
Topo
{
// private function
template
<
typename
MAP
>
void
reverse2MapFaceKeepPhi2
(
MAP
&
map
,
Dart
d
)
{
unsigned
int
first
=
map
.
template
getEmbedding
<
VERTEX
>(
d
);
Dart
e
=
d
;
do
{
Dart
f
=
map
.
phi1
(
e
);
unsigned
int
emb
=
map
.
template
getEmbedding
<
VERTEX
>(
f
);
map
.
template
setDartEmbedding
<
VERTEX
>(
e
,
emb
);
e
=
f
;
}
while
(
e
!=
d
);
map
.
template
setDartEmbedding
<
VERTEX
>(
map
.
phi_1
(
d
),
first
);
map
.
reverseCycle
(
d
);
}
// private function
inline
Dart
findOtherInCouplesOfDarts
(
const
std
::
vector
<
Dart
>&
couples
,
Dart
d
)
{
unsigned
int
nb
=
couples
.
size
();
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
if
(
couples
[
i
]
==
d
)
{
if
(
i
%
2
==
0
)
return
couples
[
i
+
1
];
//else
return
couples
[
i
-
1
];
}
}
return
NIL
;
}
template
<
typename
MAP
>
void
uniformOrientationCC
(
MAP
&
map
,
Dart
faceSeed
)
{
// first bufferize boundary edges
std
::
vector
<
Dart
>
boundEdges
;
TraversorE
<
MAP
>
travEdge
(
map
);
for
(
Dart
d
=
travEdge
.
begin
();
d
!=
travEdge
.
end
();
d
=
travEdge
.
next
())
{
if
(
map
.
isBoundaryEdge
(
d
))
boundEdges
.
push_back
(
d
);
}
// store couple of boundary edges the have same embedding
std
::
vector
<
Dart
>
couples
;
int
nb
=
boundEdges
.
size
();
int
nbm
=
nb
-
1
;
for
(
int
i
=
0
;
i
<
nbm
;
++
i
)
{
if
(
boundEdges
[
i
]
!=
NIL
)
{
for
(
int
j
=
i
+
1
;
j
<
nb
;
++
j
)
{
if
(
boundEdges
[
j
]
!=
NIL
)
{
Dart
d
=
boundEdges
[
i
];
Dart
d1
=
map
.
phi1
(
d
);
Dart
e
=
boundEdges
[
j
];
Dart
e1
=
map
.
phi1
(
e
);
if
((
map
.
template
getEmbedding
<
VERTEX
>(
d
)
==
map
.
template
getEmbedding
<
VERTEX
>(
e
))
&&
(
map
.
template
getEmbedding
<
VERTEX
>(
d1
)
==
map
.
template
getEmbedding
<
VERTEX
>(
e1
)))
{
couples
.
push_back
(
d
);
couples
.
push_back
(
e
);
boundEdges
[
j
]
=
NIL
;
// not using the dart again
j
=
nb
;
// out of the loop
}
}
}
}
}
// vector of front propagation for good orientation
std
::
vector
<
Dart
>
propag
;
boundEdges
.
clear
();
propag
.
swap
(
boundEdges
);
// reused memory of boundEdges
// vector of front propagation for wrong orientation
std
::
vector
<
Dart
>
propag_inv
;
//vector of faces to invert
std
::
vector
<
Dart
>
face2invert
;
// optimize memory reserve
propag_inv
.
reserve
(
1024
);
face2invert
.
reserve
(
1024
);
DartMarker
cmf
(
map
);
cmf
.
markOrbit
<
FACE
>
(
faceSeed
);
propag
.
push_back
(
faceSeed
);
while
(
!
propag
.
empty
()
||
!
propag_inv
.
empty
())
{
if
(
!
propag
.
empty
())
{
Dart
f
=
propag
.
back
();
propag
.
pop_back
();
Dart
d
=
f
;
do
{
Dart
e
=
map
.
phi2
(
d
);
if
(
map
.
isBoundaryMarked2
(
e
))
{
e
=
findOtherInCouplesOfDarts
(
couples
,
d
);
if
(
e
!=
NIL
)
{
if
(
!
cmf
.
isMarked
(
e
))
{
propag_inv
.
push_back
(
e
);
face2invert
.
push_back
(
e
);
cmf
.
markOrbit
<
FACE
>
(
e
);
}
cmf
.
mark
(
map
.
phi2
(
e
));
// use cmf also to mark boudary cycle to invert
}
}
else
{
if
(
!
cmf
.
isMarked
(
e
))
{
propag
.
push_back
(
e
);
cmf
.
markOrbit
<
FACE
>
(
e
);
}
}
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
f
);
}
if
(
!
propag_inv
.
empty
())
{
Dart
f
=
propag_inv
.
back
();
propag_inv
.
pop_back
();
Dart
d
=
f
;
do
{
Dart
e
=
map
.
phi2
(
d
);
if
(
map
.
isBoundaryMarked2
(
e
))
{
e
=
findOtherInCouplesOfDarts
(
couples
,
d
);
if
(
e
!=
NIL
)
{
if
(
!
cmf
.
isMarked
(
e
))
{
propag
.
push_back
(
e
);
cmf
.
markOrbit
<
FACE
>
(
e
);
}
cmf
.
mark
(
map
.
phi2
(
d
));
// use cmf also to mark boudary cycle to invert
}
}
else
{
if
(
!
cmf
.
isMarked
(
e
))
{
propag_inv
.
push_back
(
e
);
face2invert
.
push_back
(
e
);
cmf
.
markOrbit
<
FACE
>
(
e
);
}
}
d
=
map
.
phi1
(
d
);
// traverse all edges of face
}
while
(
d
!=
f
);
}
}
// reverse all faces of the wrong orientation
for
(
std
::
vector
<
Dart
>::
iterator
id
=
face2invert
.
begin
();
id
!=
face2invert
.
end
();
++
id
)
reverse2MapFaceKeepPhi2
<
MAP
>
(
map
,
*
id
);
// reverse the boundary cycles that bound reverse faces
for
(
std
::
vector
<
Dart
>::
iterator
id
=
couples
.
begin
();
id
!=
couples
.
end
();
++
id
)
{
Dart
e
=
map
.
phi2
(
*
id
);
if
(
cmf
.
isMarked
(
e
))
// check cmf for wrong orientation
{
reverse2MapFaceKeepPhi2
<
MAP
>
(
map
,
e
);
cmf
.
unmarkOrbit
<
FACE
>
(
e
);
}
}
// sew the faces that correspond to couples of boundary edges
for
(
std
::
vector
<
Dart
>::
iterator
id
=
couples
.
begin
();
id
!=
couples
.
end
();
++
id
)
// second ++ inside !
{
Dart
d
=
*
id
++
;
Dart
e
=
*
id
;
map
.
sewFaces
(
d
,
e
);
}
}
}
// namespace Topo
}
// namespace Algo
}
// namespace CGoGN
include/Topology/generic/genericmap.hpp
View file @
b9fb2856
...
...
@@ -544,15 +544,30 @@ inline void GenericMap::updateQuickTraversal()
{
assert
(
m_quickTraversal
[
ORBIT
]
!=
NULL
||
!
"updateQuickTraversal on a disabled orbit"
)
;
CellMarker
<
ORBIT
>
cm
(
*
this
)
;
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
// CellMarker<ORBIT> cm(*this) ;
// for(Dart d = begin(); d != end(); next(d))
// {
// if ((!cm.isMarked(d)) && (!isBoundaryMarkedCurrent(d)))
// {
// cm.mark(d) ;
// (*m_quickTraversal[ORBIT])[getEmbedding<ORBIT>(d)] = d ;
// }
// }
// ensure that we do not try to use quick traversal in Traversors
AttributeMultiVector
<
Dart
>*
qt
=
m_quickTraversal
[
ORBIT
];
m_quickTraversal
[
ORBIT
]
=
NULL
;
// fill the quick travsersal
TraversorCell
<
GenericMap
,
VOLUME
>
trav
(
*
this
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
!
cm
.
isMarked
(
d
))
{
cm
.
mark
(
d
)
;
(
*
m_quickTraversal
[
ORBIT
])[
getEmbedding
<
ORBIT
>
(
d
)]
=
d
;
}
(
*
qt
)[
getEmbedding
<
ORBIT
>
(
d
)]
=
d
;
}
// restore ptr
m_quickTraversal
[
ORBIT
]
=
qt
;
}
template
<
unsigned
int
ORBIT
>
...
...
include/Topology/generic/traversorCell.h
View file @
b9fb2856
...
...
@@ -33,6 +33,19 @@
namespace
CGoGN
{
/// Macro for simple syntax traversal (can be nested)
/// parameters:
/// - cell type
/// - name of iterator variable (automatically declared)
/// - map type
/// - map used
///
/// Ex: FOR_ALL_CELLS(VERTEX, di, myMap) { ... }
///
#define FOR_ALL_CELLS(ORBIT, NAME_ITER, MAP_TYPE, MAP_PARAM) TraversorCell<MAP_TYPE, (ORBIT)> NAME_ITER_TraversalMacroLocalLoop(MAP_PARAM); \
for (Dart NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.begin(); NAME_ITER != NAME_ITER_TraversalMacroLocalLoop.end(); NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.next())
template
<
typename
MAP
,
unsigned
int
ORBIT
>
class
TraversorCell
//: public Traversor<MAP>
{
...
...
include/Topology/generic/traversorCellVirt.h
View file @
b9fb2856
...
...
@@ -37,20 +37,20 @@ template <typename MAP, unsigned int ORBIT>
class
VTraversorCell
:
public
Traversor
{
private:
MAP
&
m
;
const
MAP
&
m
;
AttributeContainer
*
cont
;
const
AttributeContainer
*
cont
;
unsigned
int
qCurrent
;
DartMarker
*
dmark
;
CellMarker
<
ORBIT
>*
cmark
;
AttributeMultiVector
<
Dart
>*
quickTraversal
;
const
AttributeMultiVector
<
Dart
>*
quickTraversal
;
Dart
current
;
bool
firstTraversal
;
public:
VTraversorCell
(
MAP
&
map
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
;
VTraversorCell
(
const
MAP
&
map
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
;
~
VTraversorCell
()
;
...
...
@@ -68,20 +68,20 @@ template <unsigned int ORBIT>
class
VTraversorCell
<
GenericMap
,
ORBIT
>
:
public
Traversor
{
private:
GenericMap
&
m
;
const
GenericMap
&
m
;
AttributeContainer
*
cont
;
const
AttributeContainer
*
cont
;
unsigned
int
qCurrent
;
DartMarker
*
dmark
;
CellMarker
<
ORBIT
>*
cmark
;
AttributeMultiVector
<
Dart
>*
quickTraversal
;
const
AttributeMultiVector
<
Dart
>*
quickTraversal
;
Dart
current
;
bool
firstTraversal
;
public:
VTraversorCell
(
GenericMap
&
map
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
;
VTraversorCell
(
const
GenericMap
&
map
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
;
~
VTraversorCell
()
;
...
...
include/Topology/generic/traversorCellVirt.hpp
View file @
b9fb2856
...
...
@@ -26,7 +26,7 @@ namespace CGoGN
{
template
<
typename
MAP
,
unsigned
int
ORBIT
>
VTraversorCell
<
MAP
,
ORBIT
>::
VTraversorCell
(
MAP
&
map
,
bool
forceDartMarker
,
unsigned
int
thread
)
:
VTraversorCell
<
MAP
,
ORBIT
>::
VTraversorCell
(
const
MAP
&
map
,
bool
forceDartMarker
,
unsigned
int
thread
)
:
m
(
map
),
dmark
(
NULL
),
cmark
(
NULL
),
quickTraversal
(
NULL
),
current
(
NIL
),
firstTraversal
(
true
)
{
if
(
forceDartMarker
)
...
...
@@ -159,7 +159,7 @@ void VTraversorCell<MAP, ORBIT>::skip(Dart d)
//special version (partial specialization) for Genric Map
template
<
unsigned
int
ORBIT
>
VTraversorCell
<
GenericMap
,
ORBIT
>::
VTraversorCell
(
GenericMap
&
map
,
bool
forceDartMarker
,
unsigned
int
thread
)
:
VTraversorCell
<
GenericMap
,
ORBIT
>::
VTraversorCell
(
const
GenericMap
&
map
,
bool
forceDartMarker
,
unsigned
int
thread
)
:
m
(
map
),
dmark
(
NULL
),
cmark
(
NULL
),
quickTraversal
(
NULL
),
current
(
NIL
),
firstTraversal
(
true
)
{
if
(
forceDartMarker
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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