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
David Cazier
CGoGN
Commits
627c2b96
Commit
627c2b96
authored
Jan 06, 2012
by
untereiner
Browse files
qq modifs dans la subdiv
parent
21adc396
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
627c2b96
...
...
@@ -210,41 +210,34 @@ inline void ImplicitHierarchicalMap3::next(Dart& d)
inline
bool
ImplicitHierarchicalMap3
::
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
DartMarkerStore
mv
(
*
this
,
thread
);
// Lock a marker
DartMarkerStore
mv
(
*
this
,
thread
);
// Lock a marker
bool
found
=
false
;
// Last functor return value
std
::
vector
<
Dart
>
darts
;
//Darts that are traversed
darts
.
reserve
(
512
);
darts
.
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
(
unsigned
int
i
=
0
;
!
found
&&
i
<
darts
.
size
();
++
i
)
{
Dart
dc
=
darts
[
i
];
// add phi21 and phi23 successor if they are not marked yet
Dart
d2
=
phi2
(
darts
[
i
]);
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
//add phi21 and phi23 successor if they are not marked yet
Dart
d2
=
phi2
(
dc
);
if
(
d2
!=
dc
)
if
(
!
mv
.
isMarked
(
d21
))
{
Dart
d21
=
phi1
(
d2
);
// turn in volume
Dart
d23
=
phi3
(
d2
);
// change volume
if
(
!
mv
.
isMarked
(
d21
))
{
darts
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
if
((
d23
!=
d2
)
&&
!
mv
.
isMarked
(
d23
))
{
darts
.
push_back
(
d23
);
mv
.
mark
(
d23
);
}
darts
.
push_back
(
d21
);
mv
.
mark
(
d21
);
}
if
(
!
mv
.
isMarked
(
d23
))
{
darts
.
push_back
(
d23
);
mv
.
mark
(
d23
);
}
found
=
f
(
d
c
);
found
=
f
(
d
arts
[
i
]
);
}
return
found
;
}
...
...
@@ -278,26 +271,22 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_face(Dart d, Func
inline
bool
ImplicitHierarchicalMap3
::
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
if
(
foreach_dart_of_oriented_face
(
d
,
f
))
return
true
;
Dart
d3
=
phi3
(
d
);
if
(
d3
!=
d
)
return
foreach_dart_of_oriented_face
(
d3
,
f
);
return
false
;
return
foreach_dart_of_oriented_face
(
d
,
f
,
thread
)
||
foreach_dart_of_oriented_face
(
phi3
(
d
),
f
,
thread
);
}
inline
bool
ImplicitHierarchicalMap3
::
foreach_dart_of_oriented_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
DartMarkerStore
mark
(
*
this
);
// Lock a marker
DartMarkerStore
mark
(
*
this
,
thread
);
// Lock a marker
bool
found
=
false
;
// Last functor return value
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
512
)
;
visitedFaces
.
reserve
(
1024
)
;
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// For every face added to the list
for
(
unsigned
int
i
=
0
;
!
found
&&
i
<
visitedFaces
.
size
();
++
i
)
{
if
(
!
mark
.
isMarked
(
visitedFaces
[
i
]))
// Face has not been visited yet
if
(
!
mark
.
isMarked
(
visitedFaces
[
i
]))
// Face has not been visited yet
{
// Apply functor to the darts of the face
found
=
foreach_dart_of_oriented_face
(
visitedFaces
[
i
],
f
);
...
...
@@ -306,15 +295,15 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_volume(Dart d, Fu
// and add non visited adjacent faces to the list of face
if
(
!
found
)
{
Dart
dNext
=
visitedFaces
[
i
]
;
Dart
e
=
visitedFaces
[
i
]
;
do
{
mark
.
mark
(
dNext
);
// Mark
Dart
adj
=
phi2
(
dNext
);
// Get adjacent face
if
(
adj
!=
dNext
&&
!
mark
.
isMarked
(
adj
))
mark
.
mark
(
e
);
// Mark
Dart
adj
=
phi2
(
e
);
// Get adjacent face
if
(
!
mark
.
isMarked
(
adj
))
visitedFaces
.
push_back
(
adj
);
// Add it
dNext
=
phi1
(
dNext
);
}
while
(
dNext
!=
visitedFaces
[
i
]);
e
=
phi1
(
e
);
}
while
(
e
!=
visitedFaces
[
i
]);
}
}
}
...
...
@@ -328,7 +317,41 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_volume(Dart d, FunctorType
inline
bool
ImplicitHierarchicalMap3
::
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
)
{
return
foreach_dart_of_oriented_volume
(
d
,
f
)
;
//return foreach_dart_of_oriented_volume(d, f) ;
DartMarkerStore
mv
(
*
this
,
thread
);
// Lock a marker
bool
found
=
false
;
// Last functor return value
std
::
vector
<
Dart
>
darts
;
// Darts that are traversed
darts
.
reserve
(
1024
);
darts
.
push_back
(
d
);
// Start with the dart d
mv
.
mark
(
d
);
for
(
unsigned
int
i
=
0
;
!
found
&&
i
<
darts
.
size
();
++
i
)
{
// add all successors if they are not marked yet
Dart
d2
=
phi1
(
darts
[
i
]);
// turn in face
Dart
d3
=
phi2
(
darts
[
i
]);
// change face
Dart
d4
=
phi3
(
darts
[
i
]);
// change volume
if
(
!
mv
.
isMarked
(
d2
))
{
darts
.
push_back
(
d2
);
mv
.
mark
(
d2
);
}
if
(
!
mv
.
isMarked
(
d3
))
{
darts
.
push_back
(
d2
);
mv
.
mark
(
d2
);
}
if
(
!
mv
.
isMarked
(
d4
))
{
darts
.
push_back
(
d4
);
mv
.
mark
(
d4
);
}
found
=
f
(
darts
[
i
]);
}
return
found
;
}
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
627c2b96
...
...
@@ -279,36 +279,54 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3&
std
::
vector
<
Dart
>
newEdges
;
//save darts from inner edges
newEdges
.
reserve
(
50
);
DartMarker
mSplitted
(
map
);
int
i
=
0
;
//
DartMarker mSplitted(map);
//
//
int i = 0;
//Second step : deconnect each corner, close each hole, subdivide each new face into 3
for
(
std
::
vector
<
Dart
>::
iterator
edge
=
oldEdges
.
begin
();
edge
!=
oldEdges
.
end
();
++
edge
)
{
std
::
vector
<
Dart
>
v
;
Dart
e
=
map
.
beginSplittingPath
(
*
edge
,
mSplitted
);
// std::vector<Dart> v ;
// Dart e = map.beginSplittingPath(*edge, mSplitted);
//
// std::cout << "e = " << e << "plop" << std::endl;
//
// //Tous les brins ont deja ete decousus, il n'y a pas de chemin d'arete a construire
// if(e == NIL)
// {
// return NIL;
// }
// else
// {
// map.constructSplittingPath(e, v, mSplitted);
// }
//
// std::cout << std::endl;
// for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
// std::cout << *it << std::endl;
// std::cout << std::endl;
//
// i++;
// if(i == 2)
// return NIL;
std
::
cout
<<
"e = "
<<
e
<<
"plop"
<<
std
::
endl
;
Dart
e
=
*
edge
;
//Tous les brins ont deja ete decousus, il n'y a pas de chemin d'arete a construire
if
(
e
==
NIL
)
{
return
NIL
;
}
else
std
::
vector
<
Dart
>
v
;
do
{
map
.
constructSplittingPath
(
e
,
v
,
mSplitted
);
}
v
.
push_back
(
map
.
phi1
(
map
.
phi1
(
e
))
);
v
.
push_back
(
map
.
phi1
(
e
));
std
::
cout
<<
std
::
endl
;
for
(
std
::
vector
<
Dart
>::
iterator
it
=
v
.
begin
()
;
it
!=
v
.
end
()
;
++
it
)
std
::
cout
<<
*
it
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
e
=
map
.
phi2
(
map
.
phi_1
(
e
));
}
while
(
e
!=
*
edge
);
i
++
;
if
(
i
==
2
)
return
NIL
;
// std::cout << "begin" << std::endl;
// for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
// std::cout << *it << std::endl;
// std::cout << "finished" << std::endl;
map
.
splitVolume
(
v
)
;
...
...
@@ -336,8 +354,8 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3&
dd
=
map
.
phi1
(
map
.
phi1
(
map
.
phi1
(
ne
)));
map
.
splitFace
(
ne
,
dd
)
;
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
dd
,
idface
,
FACE
);
//
unsigned int idface = map.getNewFaceId();
//
map.setFaceId(dd,idface, FACE);
newEdges
.
push_back
(
map
.
phi1
(
dd
));
...
...
@@ -348,43 +366,43 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3&
}
//
map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front()))));
map
.
deleteVolume
(
map
.
phi3
(
map
.
phi2
(
map
.
phi1
(
oldEdges
.
front
()))));
//
//Third step : 3-sew internal faces
//
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
//
{
//
Dart f1 = (*it).first;
//
Dart f2 = (*it).second;
//
//
if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2)))
//
{
//
//id pour toutes les faces interieures
//
map.sewVolumes(map.phi2(f1), map.phi2(f2));
//
//
//Fais a la couture !!!!!
//
unsigned int idface = map.getNewFaceId();
//
map.setFaceId(map.phi2(f1),idface, FACE);
//
}
//
//
//FAIS a la couture !!!!!!!
//
//id pour toutes les aretes exterieurs des faces quadrangulees
//
unsigned int idedge = map.getEdgeId(f1);
//
map.setEdgeId(map.phi2(f1), idedge, DART);
//
map.setEdgeId( map.phi2(f2), idedge, DART);
//
}
//
//
//LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
//
//id pour les aretes interieurs : (i.e. 6 pour un hexa)
//
DartMarker mne(map);
//
for(unsigned int i = 0; i < newEdges.size(); ++i)
//
{
//
if(!mne.isMarked(newEdges[i]))
//
{
//
unsigned int idedge = map.getNewEdgeId();
//
map.setEdgeId(newEdges[i], idedge, EDGE);
//
mne.markOrbit(EDGE, newEdges[i]);
//
}
//
}
//Third step : 3-sew internal faces
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedfaces
.
begin
();
it
!=
subdividedfaces
.
end
();
++
it
)
{
Dart
f1
=
(
*
it
).
first
;
Dart
f2
=
(
*
it
).
second
;
if
(
map
.
isBoundaryFace
(
map
.
phi2
(
f1
))
&&
map
.
isBoundaryFace
(
map
.
phi2
(
f2
)))
{
//id pour toutes les faces interieures
map
.
sewVolumes
(
map
.
phi2
(
f1
),
map
.
phi2
(
f2
));
//Fais a la couture !!!!!
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
map
.
phi2
(
f1
),
idface
,
FACE
);
}
//FAIS a la couture !!!!!!!
//id pour toutes les aretes exterieurs des faces quadrangulees
unsigned
int
idedge
=
map
.
getEdgeId
(
f1
);
map
.
setEdgeId
(
map
.
phi2
(
f1
),
idedge
,
DART
);
map
.
setEdgeId
(
map
.
phi2
(
f2
),
idedge
,
DART
);
}
//LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
//id pour les aretes interieurs : (i.e. 6 pour un hexa)
DartMarker
mne
(
map
);
for
(
unsigned
int
i
=
0
;
i
<
newEdges
.
size
();
++
i
)
{
if
(
!
mne
.
isMarked
(
newEdges
[
i
]))
{
unsigned
int
idedge
=
map
.
getNewEdgeId
();
map
.
setEdgeId
(
newEdges
[
i
],
idedge
,
EDGE
);
mne
.
markOrbit
(
EDGE
,
newEdges
[
i
]);
}
}
map
.
setCurrentLevel
(
cur
)
;
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
627c2b96
...
...
@@ -369,8 +369,7 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the good parameter ?)"
<<
CGoGNendl
;
//d = map.end();
break
;
d
=
map
.
end
();
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
...
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
View file @
627c2b96
...
...
@@ -374,9 +374,9 @@ unsigned int ImplicitHierarchicalMap3::volumeLevel(Dart d)
//on cherche le brin de niveau le plus bas de la hierarchie
//on note le niveau le plus bas de la hierarchie
mark
.
markOrbit
(
FACE
,
d
)
;
for
(
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
for
(
unsigned
int
i
=
0
;
i
<
visitedFaces
.
size
();
++
i
)
{
Dart
e
=
*
face
;
Dart
e
=
visitedFaces
[
i
]
;
// in a first time, the level of a face
//the level of the volume is the minimum of the
...
...
@@ -446,10 +446,10 @@ unsigned int ImplicitHierarchicalMap3::volumeLevel(Dart d)
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
(
FACE
,
ee
)
;
mark
.
markOrbit
(
ORIENTED_
FACE
,
ee
)
;
}
e
=
phi1
(
e
)
;
}
while
(
e
!=
*
face
)
;
}
while
(
e
!=
visitedFaces
[
i
]
)
;
}
...
...
@@ -506,17 +506,18 @@ Dart ImplicitHierarchicalMap3::volumeOldestDart(Dart d)
Dart
oldest
=
d
;
DartMarkerStore
mark
(
*
this
);
// Lock a marker
std
::
list
<
Dart
>
visitedFaces
;
// Faces that are traversed
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
512
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
std
::
list
<
Dart
>::
iterator
face
;
std
::
vector
<
Dart
>::
iterator
face
;
// For every face added to the list
//the oldest dart from a volume is the oldest dart from all faces of this volume
mark
.
markOrbit
(
FACE
,
d
)
;
for
(
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
for
(
unsigned
int
i
=
0
;
i
<
visitedFaces
.
size
();
++
i
)
{
Dart
e
=
*
face
;
Dart
e
=
visitedFaces
[
i
]
;
//for every dart in this face
Dart
old
=
faceOldestDart
(
e
);
...
...
@@ -529,10 +530,10 @@ Dart ImplicitHierarchicalMap3::volumeOldestDart(Dart d)
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
(
FACE
,
ee
)
;
mark
.
markOrbit
(
ORIENTED_
FACE
,
ee
)
;
}
e
=
phi1
(
e
)
;
}
while
(
e
!=
*
face
)
;
}
while
(
e
!=
visitedFaces
[
i
]
)
;
}
return
oldest
;
...
...
@@ -591,9 +592,9 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d)
//on cherche le brin de niveau le plus bas de la hierarchie
//on note le niveau le plus bas de la hierarchie
mark
.
markOrbit
(
FACE
,
d
)
;
for
(
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
for
(
unsigned
int
i
=
0
;
i
<
visitedFaces
.
size
();
++
i
)
{
Dart
e
=
*
face
;
Dart
e
=
visitedFaces
[
i
]
;
// in a first time, the level of a face
//the level of the volume is the minimum of the
...
...
@@ -607,10 +608,10 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d)
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
(
FACE
,
ee
)
;
mark
.
markOrbit
(
ORIENTED_
FACE
,
ee
)
;
}
e
=
phi1
(
e
)
;
}
while
(
e
!=
*
face
)
;
}
while
(
e
!=
visitedFaces
[
i
]
)
;
}
//mais pas le volume lui-meme
...
...
@@ -781,7 +782,7 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
if
(
!
mf
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mf
.
markOrbit
(
FACE
,
ee
)
;
mf
.
markOrbit
(
ORIENTED_
FACE
,
ee
)
;
}
e
=
phi1
(
e
)
;
...
...
src/Topology/map/map3.cpp
View file @
627c2b96
...
...
@@ -475,7 +475,7 @@ bool Map3::mergeVolumes(Dart d)
void
Map3
::
splitVolume
(
std
::
vector
<
Dart
>&
vd
)
{
assert
(
checkSimpleOrientedPath
(
vd
))
;
//
assert(checkSimpleOrientedPath(vd)) ;
Dart
e
=
vd
.
front
();
Dart
e2
=
phi2
(
e
);
...
...
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