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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
4e1f6ec2
Commit
4e1f6ec2
authored
Oct 03, 2011
by
Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mise a jour pour les g-cartes
parent
4f0b45f5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
264 additions
and
3 deletions
+264
-3
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+3
-3
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+7
-0
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+27
-0
include/Topology/gmap/gmap3.hpp
include/Topology/gmap/gmap3.hpp
+20
-0
src/Topology/gmap/gmap2.cpp
src/Topology/gmap/gmap2.cpp
+29
-0
src/Topology/gmap/gmap3.cpp
src/Topology/gmap/gmap3.cpp
+178
-0
No files found.
Apps/Tuto/tuto3.cpp
View file @
4e1f6ec2
...
...
@@ -109,8 +109,8 @@ int main(int argc, char **argv)
PFP
::
TVEC3
normal
;
AttributeHandler
<
Geom
::
Vec3f
>
color
;
Dart
d2
=
myMap
.
new
Oriented
Face
(
3
);
Dart
d3
=
myMap
.
new
Oriented
Face
(
4
);
Dart
d2
=
myMap
.
newFace
(
3
);
Dart
d3
=
myMap
.
newFace
(
4
);
myMap
.
sewFaces
(
d2
,
d3
);
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
...
...
@@ -203,7 +203,7 @@ int main(int argc, char **argv)
PFP
::
TVEC3
position2
;
AttributeHandler
<
Geom
::
Vec3f
>
color2
;
Dart
dx
=
myMap2
.
new
Oriented
Face
(
4
);
Dart
dx
=
myMap2
.
newFace
(
4
);
position2
=
myMap2
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
color2
=
myMap2
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"couleur"
);
...
...
include/Topology/gmap/gmap2.h
View file @
4e1f6ec2
...
...
@@ -323,6 +323,13 @@ public:
* @param fonct functor obj ref
*/
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
fonct
,
unsigned
int
thread
=
0
);
//!
/*! TODO Ajout a valider
* restreint aux complexes simpliciaux
* Apply a functor on the all darts in the set of the link from orbit
*/
bool
foreach_dart_of_link
(
Dart
d
,
unsigned
int
orbit
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//@}
};
...
...
include/Topology/gmap/gmap3.h
View file @
4e1f6ec2
...
...
@@ -115,6 +115,33 @@ public:
bool
mergeVolumes
(
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
* are deleted and the adjacencies are updated (see deleteIfDegenerated).
* \warning This may produce two distinct vertices if the edge
* was the only link between two border faces
* @param d a dart in the deleted edge
* @param delDegenerateFaces a boolean (default to true)
*/
virtual
int
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
=
true
,
bool
delDegenerateVolumes
=
true
);
//!
/*!
*
* @param
* @param
* @param
*/
virtual
void
collapseFace
(
Dart
d
,
bool
delDegenerateFaces
=
true
,
bool
delDegenerateVolumes
=
true
);
//!
/*!
*
*/
virtual
Dart
cutSpike
(
Dart
d
);
/*! @name Cell Functors
* Apply functors to all darts of a cell
*************************************************************************/
...
...
include/Topology/gmap/gmap3.hpp
View file @
4e1f6ec2
...
...
@@ -93,6 +93,24 @@ inline Dart GMap3::beta(const Dart d)
}
}
inline
Dart
GMap3
::
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
GMap3
::
phi3
(
Dart
d
)
{
Dart
e
=
beta3
(
d
)
;
...
...
@@ -157,4 +175,6 @@ inline void GMap3::phi3unsew(Dart d)
}
// end namespace CGoGN
src/Topology/gmap/gmap2.cpp
View file @
4e1f6ec2
...
...
@@ -597,4 +597,33 @@ bool GMap2::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread)
return
found
;
}
bool
GMap2
::
foreach_dart_of_link
(
Dart
d
,
unsigned
int
orbit
,
FunctorType
&
f
,
unsigned
int
thread
)
{
if
(
orbit
==
VERTEX
)
{
Dart
dNext
=
d
;
do
{
if
(
GMap2
::
foreach_dart_of_edge
(
phi1
(
dNext
),
f
,
thread
))
return
true
;
dNext
=
alpha1
(
dNext
);
}
while
(
dNext
!=
d
);
return
false
;
}
else
if
(
orbit
==
FACE
)
{
if
(
GMap2
::
foreach_dart_of_vertex
(
phi_1
(
d
),
f
,
thread
))
return
true
;
if
(
GMap2
::
foreach_dart_of_vertex
(
phi_1
(
phi2
(
d
)),
f
,
thread
))
return
true
;
return
false
;
}
return
false
;
}
}
// namespace CGoGN
src/Topology/gmap/gmap3.cpp
View file @
4e1f6ec2
...
...
@@ -110,7 +110,185 @@ bool GMap3::mergeVolumes(Dart d)
return
false
;
}
int
GMap3
::
collapseEdge
(
Dart
d
,
bool
delDegenerateFaces
,
bool
delDegenerateVolumes
)
{
Dart
e
=
d
;
int
i
=
0
;
//stocke un brin par volume autour de l'arete
std
::
list
<
Dart
>
tmp
;
do
{
tmp
.
push_back
(
e
);
e
=
alpha2
(
e
);
i
++
;
}
while
(
e
!=
d
);
for
(
std
::
list
<
Dart
>::
iterator
it
=
tmp
.
begin
();
it
!=
tmp
.
end
();
++
it
)
{
Dart
e
=
phi2
(
*
it
);
cutSpike
(
e
);
Dart
t1
=
e
,
t2
=
e
;
//si les faces opposées ont un tetraedre cousu
if
(
phi3
(
phi2
(
phi1
(
e
)))
!=
phi2
(
phi1
(
e
)))
{
t1
=
phi3
(
phi2
(
phi1
(
e
)));
unsewVolumes
(
t1
);
}
if
(
phi3
(
phi2
(
phi_1
(
e
)))
!=
phi2
(
phi_1
(
e
)))
{
t2
=
phi3
(
phi2
(
phi_1
(
e
)));
unsewVolumes
(
t2
);
}
if
(
t1
!=
e
&&
t2
!=
e
)
{
sewVolumes
(
t1
,
t2
);
}
//unsewVolumes(e);
//unsewVolumes(*it);
deleteOrientedVolume
(
*
it
);
}
return
i
;
}
//TODO
void
GMap3
::
collapseFace
(
Dart
d
,
bool
delDegenerateFaces
,
bool
delDegenerateVolumes
)
{
Dart
e
=
d
;
std
::
list
<
Dart
>
tmp
;
//save a dart from the edge for all neighbors
do
{
//if(phi3(phi2(e)) != phi2(e))
// tmp.push_back(phi3(phi2(e)));
tmp
.
push_back
(
phi3
(
phi2
(
e
)));
e
=
phi1
(
e
);
}
while
(
e
!=
d
);
//del the last one (n-1 edge collapse)
tmp
.
pop_back
();
//CGoGNout << "#voisin=" << tmp.size() << CGoGNendl;
//collapse all the edges in the list
for
(
std
::
list
<
Dart
>::
iterator
it
=
tmp
.
begin
()
;
it
!=
tmp
.
end
()
;
++
it
)
{
Dart
d
=
*
it
;
//CGoGNout << "collapseEdge" << CGoGNendl;
//collapseEdge(*it, delDegenerateFaces, delDegenerateVolumes);
//stocke un brin par volume autour de l'arete
Dart
e
=
d
;
//stocke un brin par volume autour de l'arete
std
::
list
<
Dart
>
tmpedge
;
do
{
tmpedge
.
push_back
(
e
);
e
=
alpha2
(
e
);
}
while
(
e
!=
d
);
for
(
std
::
list
<
Dart
>::
iterator
it
=
tmpedge
.
begin
();
it
!=
tmpedge
.
end
();
++
it
)
{
Dart
e
=
phi2
(
*
it
);
cutSpike
(
e
);
Dart
t1
=
e
,
t2
=
e
;
//si les faces opposées ont un tetraedre cousu
if
(
phi3
(
phi2
(
phi1
(
e
)))
!=
phi2
(
phi1
(
e
)))
{
t1
=
phi3
(
phi2
(
phi1
(
e
)));
unsewVolumes
(
t1
);
}
if
(
phi3
(
phi2
(
phi_1
(
e
)))
!=
phi2
(
phi_1
(
e
)))
{
t2
=
phi3
(
phi2
(
phi_1
(
e
)));
unsewVolumes
(
t2
);
}
if
(
t1
!=
e
&&
t2
!=
e
)
{
sewVolumes
(
t1
,
t2
);
}
//deleteOrientedVolume(*it);
}
}
// for(std::list<Dart>::iterator it = tmp.begin() ; it != tmp.end() ; ++it)
// {
// deleteOrientedVolume(*it);
// }
}
Dart
GMap3
::
cutSpike
(
Dart
d
)
{
Dart
e
=
d
;
int
nb
=
0
;
Dart
dNew
;
int
tet
=
0
;
//CGoGNout << "cut" << CGoGNendl;
//count the valence of the vertex
do
{
nb
++
;
e
=
phi1
(
phi2
(
e
));
}
while
(
e
!=
d
);
if
(
nb
<
3
)
{
CGoGNout
<<
"Warning : cannot cut 2 volumes without creating a degenerated face "
<<
CGoGNendl
;
return
d
;
}
else
{
//triangulate around the vertex
do
{
if
(
phi1
(
phi1
(
phi1
(
e
)))
!=
e
)
{
splitFace
(
phi_1
(
e
),
phi1
(
e
));
//CGoGNout << "split" << CGoGNendl;
}
else
tet
++
;
e
=
phi1
(
phi2
(
e
));
}
while
(
e
!=
d
);
// CGoGNout << "#tet= " << tet << CGoGNendl;
// CGoGNout << "#nb= " << nb << CGoGNendl;
//si toute ces faces ne sont pas triangulaires (on insere une face)
if
(
tet
!=
nb
)
{
//CGoGNout << "new face" << CGoGNendl;
dNew
=
newFace
(
nb
);
Dart
d3
=
newFace
(
nb
);
sewVolumes
(
dNew
,
d3
);
//sew a face following the triangles
Dart
dTurn
=
dNew
;
do
{
Dart
d1
=
phi1
(
e
);
Dart
dSym
=
phi2
(
d1
);
phi2unsew
(
d1
);
phi2sew
(
dTurn
,
d1
);
phi2sew
(
phi3
(
dTurn
),
dSym
);
dTurn
=
phi1
(
dTurn
);
e
=
phi1
(
phi2
(
e
));
}
while
(
e
!=
d
);
}
else
dNew
=
d
;
}
return
dNew
;
}
bool
GMap3
::
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
...
...
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