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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Etienne Schmitt
CGoGN
Commits
9b062c52
Commit
9b062c52
authored
Feb 08, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qq changements dans map3
parent
1b8843c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
252 additions
and
56 deletions
+252
-56
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
+4
-0
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
+245
-22
include/Topology/map/map2.h
include/Topology/map/map2.h
+0
-7
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+0
-8
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+3
-19
No files found.
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
View file @
9b062c52
...
...
@@ -64,6 +64,10 @@ template <typename PFP>
Dart
subdivideVolumeClassic2
(
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 *
***********************************************************************************/
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
9b062c52
...
...
@@ -82,19 +82,22 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
map
.
setCurrentLevel
(
fLevel
)
;
// go to the level of the face to subdivide its edges
unsigned
int
degree
=
0
;
typename
PFP
::
VEC3
p
;
Dart
it
=
old
;
do
Traversor2FE
<
typename
PFP
::
MAP
>
travE
(
map
,
old
);
for
(
Dart
it
=
travE
.
begin
();
it
!=
travE
.
end
()
;
it
=
travE
.
next
())
{
++
degree
;
p
+=
position
[
it
]
;
if
(
!
map
.
edgeIsSubdivided
(
it
))
// first cut the edges (if they are not already)
Algo
::
IHM
::
subdivideEdge
<
PFP
>
(
map
,
it
,
position
)
;
// and compute the degree of the face
it
=
map
.
phi1
(
it
)
;
}
while
(
it
!=
old
)
;
}
p
/=
typename
PFP
::
REAL
(
degree
)
;
map
.
setCurrentLevel
(
fLevel
+
1
)
;
// go to the next level to perform face subdivision
Dart
res
;
...
...
@@ -395,6 +398,8 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
*/
typename
PFP
::
VEC3
volCenter
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
map
,
old
,
position
);
Traversor3WV
<
typename
PFP
::
MAP
>
traV
(
map
,
old
);
/*
* Subdivide Faces
*/
...
...
@@ -411,46 +416,62 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
//save a dart from the subdivided face
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
unsigned
int
fLevel
=
map
.
faceLevel
(
d
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
unsigned
int
fLevel
=
map
.
faceLevel
(
d
it
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
map
.
setCurrentLevel
(
fLevel
)
;
//le brin est forcement du niveau cur
Dart
cf
=
map
.
phi
1
(
d
);
Dart
cf
=
map
.
phi
2
(
map
.
phi1
(
dit
)
);
Dart
e
=
cf
;
do
{
subdividedfaces
.
push_back
(
std
::
pair
<
Dart
,
Dart
>
(
e
,
map
.
phi2
(
e
)));
e
=
map
.
phi2
(
map
.
phi1
(
e
));
e
=
map
.
phi2
(
map
.
phi
_
1
(
e
));
}
while
(
e
!=
cf
);
map
.
setCurrentLevel
(
cur
);
}
unsigned
int
fLevel
=
map
.
faceLevel
(
old
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
map
.
setCurrentLevel
(
fLevel
)
;
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedfaces
.
begin
();
it
!=
subdividedfaces
.
end
();
++
it
)
{
Dart
f1
=
(
*
it
).
first
;
if
(
!
map
.
Map2
::
isBoundaryEdge
(
f1
))
{
Dart
f2
=
map
.
phi2
(
f1
);
map
.
unsewFaces
(
f1
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f2
),
f1
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f1
),
f2
);
}
}
map
.
setCurrentLevel
(
cur
);
/*
* Create inside volumes
*/
std
::
vector
<
Dart
>
newEdges
;
//save darts from inner edges
newEdges
.
reserve
(
50
);
Dart
centralDart
=
NIL
;
Traversor3WV
<
typename
PFP
::
MAP
>
traV
(
map
,
old
);
map
.
setCurrentLevel
(
vLevel
+
1
)
;
// go to the next level to perform volume subdivision
for
(
Dart
dit
=
traV
.
begin
();
dit
!=
traV
.
end
();
dit
=
traV
.
next
())
{
Dart
e
=
dit
;
std
::
vector
<
Dart
>
v
;
do
{
v
.
push_back
(
map
.
phi1
(
map
.
phi1
(
e
)));
v
.
push_back
(
map
.
phi1
(
e
));
//unsigned int degree = 0 ;
//typename PFP::VEC3 volCenter ;
e
=
map
.
phi2
(
map
.
phi_1
(
e
));
}
while
(
e
!=
dit
);
map
.
setCurrentLevel
(
vLevel
+
1
)
;
// go to the next level to perform volume subdivision
map
.
splitVolume
(
v
)
;
for
(
Dart
dit
=
traV
.
begin
();
dit
!=
traV
.
end
();
dit
=
traV
.
next
())
{
//volCenter += position[d];
//++degree;
Dart
old
=
map
.
phi2
(
map
.
phi1
(
dit
));
map
.
Map2
::
fillHole
(
old
);
Dart
dd
=
map
.
phi1
(
map
.
phi1
(
old
))
;
map
.
splitFace
(
old
,
dd
)
;
...
...
@@ -461,9 +482,9 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
map
.
cutEdge
(
ne
);
centralDart
=
map
.
phi1
(
ne
);
position
[
centralDart
]
=
volCenter
;
newEdges
.
push_back
(
ne
);
newEdges
.
push_back
(
map
.
phi1
(
ne
));
position
[
centralDart
]
=
volCenter
;
unsigned
int
id
=
map
.
getNewEdgeId
()
;
map
.
setEdgeId
(
ne
,
id
,
EDGE
)
;
...
...
@@ -488,6 +509,20 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
}
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
)))
{
map
.
sewVolumes
(
map
.
phi2
(
f1
),
map
.
phi2
(
f2
));
}
}
//volCenter /= double(degree);
// //Third step : 3-sew internal faces
// for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
// {
...
...
@@ -536,6 +571,194 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
}
template
<
typename
PFP
>
void
subdivideLoop
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
)
{
assert
(
map
.
getDartLevel
(
d
)
<=
map
.
getCurrentLevel
()
||
!
"Access to a dart introduced after current level"
)
;
assert
(
!
map
.
volumeIsSubdivided
(
d
)
||
!
"Trying to subdivide an already subdivided volume"
)
;
assert
(
!
map
.
isBoundaryMarked
(
d
)
||
!
"Trying to subdivide a dart marked boundary"
);
unsigned
int
vLevel
=
map
.
volumeLevel
(
d
);
Dart
old
=
map
.
volumeOldestDart
(
d
);
unsigned
int
cur
=
map
.
getCurrentLevel
();
map
.
setCurrentLevel
(
vLevel
);
/*
* Compute volume centroid
*/
typename
PFP
::
VEC3
volCenter
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
map
,
old
,
position
);
/*
* Subdivide Faces
*/
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>
subdividedfaces
;
subdividedfaces
.
reserve
(
25
);
Traversor3WF
<
typename
PFP
::
MAP
>
traF
(
map
,
old
);
for
(
Dart
dit
=
traF
.
begin
();
dit
!=
traF
.
end
();
dit
=
traF
.
next
())
{
//if needed subdivide face
if
(
!
map
.
faceIsSubdivided
(
dit
))
Algo
::
IHM
::
subdivideFace
<
PFP
>
(
map
,
dit
,
position
,
Algo
::
IHM
::
S_TRI
);
//save a dart from the subdivided face
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
unsigned
int
fLevel
=
map
.
faceLevel
(
d
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
map
.
setCurrentLevel
(
fLevel
)
;
//le brin est forcement du niveau cur
Dart
cf
=
map
.
phi1
(
d
);
Dart
e
=
cf
;
do
{
subdividedfaces
.
push_back
(
std
::
pair
<
Dart
,
Dart
>
(
e
,
map
.
phi2
(
e
)));
e
=
map
.
phi2
(
map
.
phi1
(
e
));
}
while
(
e
!=
cf
);
map
.
setCurrentLevel
(
cur
);
}
/*
* Create inside volumes
*/
std
::
vector
<
Dart
>
newEdges
;
//save darts from inner edges
newEdges
.
reserve
(
50
);
Dart
centralDart
=
NIL
;
//unsigned int degree = 0 ;
//typename PFP::VEC3 volCenter ;
Traversor3WV
<
typename
PFP
::
MAP
>
traV
(
map
,
old
);
bool
isNotTet
=
false
;
map
.
setCurrentLevel
(
vLevel
+
1
)
;
// go to the next level to perform volume subdivision
for
(
Dart
dit
=
traV
.
begin
();
dit
!=
traV
.
end
();
dit
=
traV
.
next
())
{
//volCenter += position[d];
//++degree;
Dart
e
=
dit
;
std
::
vector
<
Dart
>
v
;
do
{
v
.
push_back
(
map
.
phi1
(
e
));
e
=
map
.
phi2
(
map
.
phi_1
(
e
));
}
while
(
e
!=
dit
);
map
.
splitVolume
(
v
)
;
//if is not a tetrahedron
unsigned
int
vdeg
=
map
.
vertexDegree
(
dit
);
if
(
vdeg
>
3
)
{
isNotTet
=
true
;
Dart
old
=
map
.
phi2
(
map
.
phi1
(
dit
));
Dart
dd
=
map
.
phi1
(
old
)
;
map
.
splitFace
(
old
,
dd
)
;
Dart
ne
=
map
.
phi1
(
old
);
map
.
cutEdge
(
ne
);
position
[
map
.
phi1
(
ne
)]
=
volCenter
;
//plonger a la fin de la boucle ????
centralDart
=
map
.
phi1
(
ne
);
newEdges
.
push_back
(
ne
);
newEdges
.
push_back
(
map
.
phi1
(
ne
));
Dart
stop
=
map
.
phi2
(
map
.
phi1
(
ne
));
ne
=
map
.
phi2
(
ne
);
do
{
dd
=
map
.
phi1
(
map
.
phi1
(
ne
));
map
.
splitFace
(
ne
,
dd
)
;
newEdges
.
push_back
(
map
.
phi1
(
dd
));
ne
=
map
.
phi2
(
map
.
phi_1
(
ne
));
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
stop
);
}
// else
// {
// unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f1),idface, FACE);
// }
}
//switch inner faces
if
(
isNotTet
)
{
unsigned
int
i
=
0
;
for
(
Dart
dit
=
traV
.
begin
();
dit
!=
traV
.
end
();
dit
=
traV
.
next
())
{
Dart
x
=
map
.
phi_1
(
map
.
phi2
(
map
.
phi1
(
dit
)));
Dart
f
=
x
;
do
{
Dart
f3
=
map
.
phi3
(
f
);
Dart
tmp
=
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
f3
)))));
//future voisin par phi2
map
.
unsewFaces
(
f3
);
map
.
unsewFaces
(
tmp
);
map
.
sewFaces
(
f3
,
tmp
,
false
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f3
),
tmp
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
tmp
),
f3
);
// map.embedOrbit(VERTEX, f3, map.getEmbedding(VERTEX, f3)) ;
// map.embedOrbit(VERTEX, tmp, map.getEmbedding(VERTEX, tmp)) ;
// unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f3),idface, FACE);
f
=
map
.
phi2
(
map
.
phi_1
(
f
));
}
while
(
f
!=
x
);
}
}
position
[
centralDart
]
=
volCenter
;
// //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;
//
// //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. 16 pour un octa)
// DartMarker mne(map);
// for(std::vector<Dart>::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it)
// {
// if(!mne.isMarked(*it))
// {
// unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId(*it, idedge, EDGE);
// mne.markOrbit(EDGE,*it);
// }
// }
//
//
// map.setCurrentLevel(cur) ;
}
template
<
typename
PFP
>
Dart
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
)
{
...
...
include/Topology/map/map2.h
View file @
9b062c52
...
...
@@ -284,13 +284,6 @@ public:
* @return true if the merge has been executed, false otherwise
*/
virtual
bool
mergeVolumes
(
Dart
d
,
Dart
e
);
//!
/*!
*
*/
virtual
void
splitCC
(
std
::
vector
<
Dart
>&
vd
);
//@}
/*! @name Topological Queries
...
...
src/Topology/map/map2.cpp
View file @
9b062c52
...
...
@@ -515,14 +515,6 @@ bool Map2::mergeVolumes(Dart d, Dart e)
return
true
;
}
void
Map2
::
splitCC
(
std
::
vector
<
Dart
>&
vd
)
{
//assert(checkSimpleOrientedPath(vd)) ;
for
(
std
::
vector
<
Dart
>::
iterator
it
=
vd
.
begin
()
;
it
!=
vd
.
end
()
;
++
it
)
Map2
::
unsewFaces
(
*
it
);
}
/*! @name Topological Queries
* Return or set various topological information
*************************************************************************/
...
...
src/Topology/map/map3.cpp
View file @
9b062c52
...
...
@@ -343,7 +343,7 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes)
void
Map3
::
splitFace
(
Dart
d
,
Dart
e
)
{
assert
(
d
!=
e
&&
Map2
::
sameOrientedFace
(
d
,
e
))
;
assert
(
d
!=
e
&&
sameOrientedFace
(
d
,
e
))
;
Dart
dd
=
phi1
(
phi3
(
d
));
Dart
ee
=
phi1
(
phi3
(
e
));
...
...
@@ -489,26 +489,10 @@ void Map3::splitVolume(std::vector<Dart>& vd)
Map2
::
unsewFaces
(
*
it
);
Map2
::
fillHole
(
e
)
;
Dart
b
=
Map1
::
newBoundaryCycle
(
vd
.
size
());
Dart
fit1
=
phi2
(
e
)
;
Dart
fit2
=
b
;
do
{
phi3sew
(
fit1
,
fit2
)
;
fit1
=
phi1
(
fit1
)
;
fit2
=
phi_1
(
fit2
)
;
}
while
(
fit2
!=
b
)
;
// if(isBoundaryMarked(e2))
// Map2::fillHole(e2) ;
Map2
::
fillHole
(
e2
)
;
//sew the two connected components
//
Map3::sewVolumes(phi2(e), phi2(e2), false);
Map3
::
sewVolumes
(
phi2
(
e
),
phi2
(
e2
),
false
);
}
/*! @name Topological Queries
...
...
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