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
KennethVanhoey
CGoGN
Commits
9de12949
Commit
9de12949
authored
Oct 03, 2011
by
Thomas
Browse files
Merge branch 'master' of cgogn.u-strasbg.fr:~untereiner/CGoGN
Conflicts: src/Topology/map/map3.cpp
parents
40d944d0
4d495942
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Apps/Tuto/tuto1.cpp
View file @
9de12949
...
...
@@ -31,6 +31,7 @@
#include
"Topology/generic/embeddedMap2.h"
#include
"Geometry/vector_gen.h"
#include
"Algo/Import/import.h"
#include
"Algo/Geometry/boundingbox.h"
...
...
Apps/Tuto/tuto2.cpp
View file @
9de12949
...
...
@@ -26,6 +26,7 @@
#include
"Topology/generic/parameters.h"
#include
"Topology/map/map2.h"
#include
"Topology/gmap/gmap2.h"
#include
"Topology/generic/mapBrowser.h"
#include
"Algo/Geometry/boundingbox.h"
...
...
@@ -41,7 +42,7 @@ using namespace CGoGN ;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
typedef
Map2
MAP
;
typedef
G
Map2
MAP
;
};
PFP
::
MAP
myMap
;
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
9de12949
...
...
@@ -274,6 +274,10 @@ public:
*/
bool
neighborhoodLevelDiffersByOne
(
Dart
d
);
/**
* wired !!!
*/
bool
coarsenNeighborhoodLevelDiffersByOne
(
Dart
d
);
}
;
template
<
typename
T
>
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
9de12949
...
...
@@ -244,7 +244,7 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType
bool
found
=
false
;
// Last functor return value
std
::
vector
<
Dart
>
darts_list
;
//Darts that are traversed
darts_list
.
reserve
(
5
0
);
darts_list
.
reserve
(
5
12
);
darts_list
.
push_back
(
d
);
//Start with the dart d
mv
.
mark
(
d
);
...
...
@@ -288,11 +288,8 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge(Dart d, FunctorType&
if
(
f
(
dNext
))
return
true
;
Dart
d2
=
phi2
(
dNext
);
if
(
d2
!=
dNext
)
return
f
(
d2
);
else
return
false
;
if
(
f
(
phi2
(
dNext
)))
return
true
;
dNext
=
alpha2
(
dNext
);
}
while
(
dNext
!=
d
);
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
View file @
9de12949
...
...
@@ -41,11 +41,15 @@ enum SubdivideType
S_QUAD
}
;
/***********************************************************************************
* Subdivision *
***********************************************************************************/
template
<
typename
PFP
>
void
subdivideEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
)
;
template
<
typename
PFP
>
void
subdivideFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
void
subdivideFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
=
S_TRI
);
template
<
typename
PFP
>
Dart
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
...
...
@@ -54,16 +58,18 @@ template <typename PFP>
Dart
subdivideVolumeGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
Dart
subdivideVolume
Old
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
Dart
subdivideVolume
Classic
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
//template <typename PFP>
//void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
/***********************************************************************************
* Simplification *
***********************************************************************************/
template
<
typename
PFP
>
void
coarsenEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
coarsenFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
void
coarsenFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
=
S_TRI
);
template
<
typename
PFP
>
void
coarsenVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
...
...
@@ -77,27 +83,7 @@ void coarsenVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
template
<
typename
PFP
>
void
splitVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
/*******************************************************
*
*/
template
<
typename
PFP
>
void
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
);
template
<
typename
PFP
>
Dart
subdivideFaceTri
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
subdivideVolumeTri
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
macCrackenJoy
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
bajaj
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
typename
PFP
::
VEC3
bajajMask
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
}
//namespace IHM
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
9de12949
This diff is collapsed.
Click to expand it.
include/Algo/Modelisation/subdivision3map.hpp
View file @
9de12949
...
...
@@ -119,8 +119,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
std
::
cout
<<
"test"
<<
std
::
endl
;
// mv.unmarkAll();
// first pass: cut edges
...
...
@@ -235,7 +233,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
//close the generated hole and create the central vertex
unsigned
int
degree
=
map
.
closeHole
(
map
.
phi1
(
d
));
std
::
cout
<<
"degree "
<<
degree
<<
std
::
endl
;
Dart
dd
=
map
.
phi1
(
map
.
phi2
(
map
.
phi1
(
d
)));
map
.
splitFace
(
map
.
phi_1
(
dd
),
map
.
phi1
(
dd
));
...
...
include/Topology/gmap/gmap1.h
View file @
9de12949
...
...
@@ -136,6 +136,15 @@ public:
* @param e a dart in the second face
*/
void
mergeFaces
(
Dart
d
,
Dart
e
);
//! 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
*/
void
linkVertices
(
Dart
d
,
Dart
e
);
//@}
/*! @name Topological Queries
...
...
include/Topology/gmap/gmap1.hpp
View file @
9de12949
...
...
@@ -234,6 +234,14 @@ inline void GMap1::mergeFaces(Dart d, Dart e)
deleteEdge
(
e
)
;
}
inline
void
GMap1
::
linkVertices
(
Dart
d
,
Dart
e
)
{
assert
(
d
!=
e
&&
!
sameOrientedFace
(
d
,
e
))
;
GMap1
::
cutEdge
(
phi_1
(
d
));
// cut the edge before d (insert a new dart before d)
GMap1
::
cutEdge
(
phi_1
(
e
));
// cut the edge before e (insert a new dart before e)
phi1sew
(
phi_1
(
d
),
phi_1
(
e
))
;
// phi1sew between the 2 new inserted darts
}
/*! @name Cell Functors
* Apply functors to all darts of a cell
*************************************************************************/
...
...
include/Topology/gmap/gmap2.h
View file @
9de12949
...
...
@@ -116,6 +116,11 @@ public:
*/
virtual
void
cutEdge
(
Dart
d
);
//! 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
);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are build (faces with less than 3 edges). If it occurs the faces
...
...
@@ -126,7 +131,7 @@ public:
* @param delDegenerateFaces a boolean (default to true)
* @return a dart of the resulting vertex
*/
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
);
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
);
/**
* Flip the edge of d. (rotation in phi1 order)
...
...
@@ -144,6 +149,20 @@ public:
*/
virtual
bool
flipBackEdge
(
Dart
d
);
//! Insert an edge after a dart in the vertex orbit
/*! \pre Dart d and e MUST be different and belong to distinct face
* \pre Dart e must be phi2-linked with its phi_1 dart
* @param d dart of the vertex
* @param e dart of the edge
*/
virtual
void
insertEdgeInVertex
(
Dart
d
,
Dart
e
);
//! Remove an edge from a vertex orbit
/*! \pre Dart d must be phi2 sewn
* @param d the dart of the edge to remove from the vertex
*/
virtual
void
removeEdgeFromVertex
(
Dart
d
);
//! Sew two oriented faces along oriented edges (pay attention to the orientation !)
/*! \pre Darts d & e MUST be fixed point of phi2 relation
* @param d a dart of the first face
...
...
include/Topology/map/map3.h
View file @
9de12949
...
...
@@ -222,7 +222,7 @@ public:
* @param d a dart in the first face
* @param e a dart in the second face
*/
virtual
void
mergeFaces
(
Dart
d
,
Dart
e
);
virtual
bool
mergeFaces
(
Dart
d
,
Dart
e
);
//!
/*!
...
...
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
View file @
9de12949
...
...
@@ -397,7 +397,7 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d)
DartMarkerStore
mark
(
*
this
);
// Lock a marker
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
16
);
visitedFaces
.
reserve
(
512
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
std
::
vector
<
Dart
>::
iterator
face
;
...
...
@@ -455,6 +455,8 @@ bool ImplicitHierarchicalMap3::edgeCanBeCoarsened(Dart d)
Dart
d2
=
phi2
(
d
)
;
++
m_curLevel
;
std
::
cout
<<
"vertex degree = "
<<
vertexDegree
(
phi1
(
d
))
<<
std
::
endl
;
if
(
vertexDegree
(
phi1
(
d
))
==
2
)
{
degree2
=
true
;
...
...
@@ -553,6 +555,7 @@ bool ImplicitHierarchicalMap3::faceIsSubdividedOnce(Dart d)
bool
ImplicitHierarchicalMap3
::
volumeIsSubdividedOnce
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
return
true
;
}
...
...
@@ -563,7 +566,7 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
bool
found
=
false
;
unsigned
int
vLevel
=
volumeLevel
(
d
)
+
1
;
unsigned
int
vLevel
=
volumeLevel
(
d
)
;
//
+ 1;
Dart
old
=
volumeOldestDart
(
d
);
...
...
@@ -571,7 +574,7 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
//Store faces that are traversed and start with the face of d
std
::
vector
<
Dart
>
visitedFaces
;
visitedFaces
.
reserve
(
2
0
);
visitedFaces
.
reserve
(
51
2
);
visitedFaces
.
push_back
(
old
);
mf
.
markOrbit
(
FACE
,
old
)
;
...
...
@@ -586,7 +589,8 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
if
(
phi3
(
e
)
!=
e
)
{
Dart
old
=
volumeOldestDart
(
phi3
(
e
));
if
((
abs
(
volumeLevel
(
old
)
-
vLevel
)
>
1
))
//if((abs(volumeLevel(old) - vLevel) > 1))
if
(
volumeLevel
(
old
)
<
vLevel
)
found
=
true
;
}
...
...
@@ -604,6 +608,55 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
return
found
;
}
bool
ImplicitHierarchicalMap3
::
coarsenNeighborhoodLevelDiffersByOne
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
bool
found
=
false
;
//unsigned int vLevel = volumeLevel(d);
Dart
old
=
volumeOldestDart
(
d
);
DartMarkerStore
mf
(
*
this
);
// Lock a face marker to save one dart per face
//Store faces that are traversed and start with the face of d
std
::
vector
<
Dart
>
visitedFaces
;
visitedFaces
.
reserve
(
512
);
visitedFaces
.
push_back
(
old
);
mf
.
markOrbit
(
FACE
,
old
)
;
for
(
std
::
vector
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
();
!
found
&&
face
!=
visitedFaces
.
end
();
++
face
)
{
Dart
e
=
*
face
;
do
{
// add all face neighbours to the table
if
(
faceIsSubdivided
(
e
))
{
++
m_curLevel
;
if
(
faceIsSubdividedOnce
(
e
))
found
=
true
;
--
m_curLevel
;
}
Dart
ee
=
phi2
(
e
)
;
if
(
!
mf
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mf
.
markOrbit
(
FACE
,
ee
)
;
}
e
=
phi1
(
e
)
;
}
while
(
e
!=
*
face
)
;
}
return
found
;
}
}
//namespace IHM
}
//namespace Algo
...
...
src/Topology/gmap/gmap2.cpp
View file @
9de12949
...
...
@@ -86,7 +86,25 @@ void GMap2::cutEdge(Dart d)
}
}
Dart
GMap2
::
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
)
void
GMap2
::
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
)
;
GMap1
::
collapseEdge
(
nd
)
;
GMap1
::
collapseEdge
(
ne
)
;
phi2sew
(
d
,
e
)
;
}
}
Dart
GMap2
::
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
)
{
Dart
resV
;
...
...
@@ -173,6 +191,20 @@ bool GMap2::flipBackEdge(Dart d)
return
false
;
// cannot flip a border edge
}
void
GMap2
::
insertEdgeInVertex
(
Dart
d
,
Dart
e
)
{
assert
(
!
sameVertex
(
d
,
e
)
&&
phi2
(
e
)
==
phi_1
(
e
));
phi1sew
(
phi_1
(
d
),
phi_1
(
e
));
}
void
GMap2
::
removeEdgeFromVertex
(
Dart
d
)
{
assert
(
phi2
(
d
)
!=
d
);
phi1sew
(
phi_1
(
d
),
phi2
(
d
));
}
void
GMap2
::
sewFaces
(
Dart
d
,
Dart
e
)
{
phi2sew
(
d
,
e
);
...
...
src/Topology/map/map3.cpp
View file @
9de12949
...
...
@@ -41,7 +41,7 @@ void Map3::deleteOrientedVolume(Dart d)
DartMarkerStore
mark
(
*
this
);
// Lock a marker
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
16
);
visitedFaces
.
reserve
(
512
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// // For every face added to the list
...
...
@@ -207,14 +207,15 @@ bool Map3::deleteVertex(Dart d)
{
DartMarkerStore
mv
(
*
this
);
// Lock a marker
std
::
list
<
Dart
>
darts_list
;
//Darts that are traversed
std
::
vector
<
Dart
>
darts_list
;
//Darts that are traversed
darts_list
.
reserve
(
512
);
darts_list
.
push_back
(
d
);
//Start with the dart d
std
::
list
<
Dart
>::
iterator
darts
;
std
::
vector
<
Dart
>::
iterator
darts
;
mv
.
mark
(
d
);
std
::
list
<
Dart
>
unique_darts_list
;
//
unique_darts_list.reserve(
30
);
std
::
vector
<
Dart
>
unique_darts_list
;
unique_darts_list
.
reserve
(
512
);
unique_darts_list
.
push_back
(
d
);
...
...
@@ -546,10 +547,11 @@ void Map3::collapseVolume(Dart d, bool delDegenerateFaces,
//contracter toutes les faces de la liste
}
//TODO
void
Map3
::
mergeFaces
(
Dart
d
,
Dart
e
)
bool
Map3
::
mergeFaces
(
Dart
d
,
Dart
e
)
{
return
false
;
}
Dart
Map3
::
cutSpike
(
Dart
d
)
...
...
@@ -663,8 +665,6 @@ unsigned int Map3::vertexDegree(Dart d)
}
}
std
::
cout
<<
"#darts = "
<<
darts_list
.
size
()
<<
std
::
endl
;
DartMarkerStore
me
(
*
this
);
for
(
darts
=
darts_list
.
begin
();
darts
!=
darts_list
.
end
()
;
++
darts
)
...
...
@@ -810,7 +810,6 @@ bool Map3::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread)
bool
Map3
::
foreach_dart_of_open_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
DartMarkerStore
mv
(
*
this
,
thread
);
// Lock a marker
bool
found
=
false
;
// Last functor return value
...
...
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