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
cd6c1705
Commit
cd6c1705
authored
May 27, 2011
by
untereiner
Browse files
subdiv IHM
parent
b9185bb7
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
cd6c1705
...
...
@@ -245,6 +245,26 @@ public:
* has already been subdivided to the next level
*/
bool
volumeIsSubdivided
(
Dart
d
);
/**
* Return true if the edge of d in the current level map
* is subdivided to the next level,
* none of its resulting edges is in turn subdivided to the next level
* and the middle vertex is of degree 2
*/
bool
edgeCanBeCoarsened
(
Dart
d
);
/**
*
*/
bool
faceIsSubdividedOnce
(
Dart
d
);
/**
*
*/
bool
volumeIsSubdividedOnce
(
Dart
d
);
}
;
template
<
typename
T
>
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
View file @
cd6c1705
...
...
@@ -50,10 +50,17 @@ void subdivideFace(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
);
template
<
typename
PFP
>
void
subdivideLoop
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
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
);
template
<
typename
PFP
>
void
coarsenVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
/*******************************************************
*
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
cd6c1705
...
...
@@ -591,6 +591,38 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
map
.
setCurrentLevel
(
cur
)
;
}
template
<
typename
PFP
>
void
coarsenEdge
(
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
.
edgeCanBeCoarsened
(
d
)
||
!
"Trying to coarsen an edge that can not be coarsened"
)
;
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
Dart
d2
=
map
.
phi2
(
d
)
;
map
.
setCurrentLevel
(
cur
+
1
)
;
unsigned
int
dl
=
map
.
getDartLevel
(
d2
)
;
map
.
setDartLevel
(
map
.
phi1
(
d2
),
dl
)
;
map
.
collapseEdge
(
d2
)
;
map
.
setCurrentLevel
(
cur
)
;
}
template
<
typename
PFP
>
void
coarsenFace
(
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.faceIsSubdividedOnce(d) || !"Trying to coarsen a non-subdivided face or a more than once subdivided face") ;
}
template
<
typename
PFP
>
void
coarsenVolume
(
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.volumeIsSubdivdedOnce(d) || !"Trying to coarsen a non-subdivided volume or a more than once subdivided volume") ;
}
/***********************************************************************************
*
*/
...
...
@@ -1372,107 +1404,14 @@ void subdivideVolumeTri(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
}
}
//namespace IHM
}
//namespace Algo
}
//namespace CGoGN
/*
//Second step : deconnect the corners
for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge)
{
Dart e = *edge;
do
{
map.unsewFaces(map.phi1(map.phi1(e)));
map.unsewFaces(map.phi1(e));
e = map.phi2(map.phi_1(e));
}while(e != *edge);
// map.unsewFaces(map.phi1(*edge));
// moe.markOrbit(DART_ORBIT,map.phi1(*edge));
// }
//
// //Third step : close the hole
// for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge)
// {
// if(moe.isMarked(map.phi1(*edge)))
// {
map.closeHole(map.phi1(*edge));
Dart h = map.phi2(map.phi1(*edge));
unsigned int degree=0;
do
{
map.setEdgeId(h,map.getEdgeId(map.phi2(h)), DART_ORBIT) ;
h = map.phi1(h);
++degree;
}while(h != map.phi2(map.phi1(*edge)));
// moe.unmark(map.phi1(*edge));
// moe.unmark(map.phi1(map.phi2(map.phi_1(*edge))));
// moe.unmark(map.phi1(map.phi1(map.phi2(*edge))));
//si nouvelle diff de tri alors subdiviser la nouvelle face
if(degree != 3)
{
Dart old = map.phi1(map.phi2(map.phi1(*edge)));
Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ;
Dart ne = map.phi2(map.phi_1(dd));
Dart ne2 = map.phi2(ne);
map.cutEdge(ne) ;
//unsigned int id = map.getNewEdgeId() ;
//map.setEdgeId(ne, id, EDGE_ORBIT) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(ne2, id, EDGE_ORBIT) ;
position[map.phi2(ne)] = volCenter;
dd = map.phi1(map.phi1(map.phi1(map.phi1(ne)))) ;
while(dd != ne)
{
Dart next = map.phi1(map.phi1(dd)) ;
map.splitFace(map.phi1(ne), dd) ;
Dart nne = map.phi2(map.phi_1(dd)) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(nne, id, EDGE_ORBIT) ;
dd = next ;
}
}
//}
}
}
//namespace IHM
// moe.unmarkAll();
}
//namespace Algo
for (std::vector<Dart>::iterator nvol = quadfaces.begin(); nvol != quadfaces.end(); nvol = nvol + 2)
{
if(map.phi3(map.phi2(*nvol)) == map.phi2(*nvol) && map.phi3(map.phi2(*(nvol+1))) == map.phi2(*(nvol+1)))
{
map.sewVolumes(map.phi2(*nvol), map.phi2(*(nvol+1)));
unsigned int idface = map.getNewFaceId();
map.setFaceId(map.phi2(*nvol),idface, FACE_ORBIT);
}
//namespace CGoGN
unsigned int idedge = map.getNewEdgeId();
map.setEdgeId(map.phi1(map.phi2(*nvol)), idedge, EDGE_ORBIT);
}
}
// Dart ec = quadfaces.front();
// unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId(map.phi1(map.phi1(ec)), idedge, EDGE_ORBIT);
//
// ec = map.phi_1(map.phi2(map.phi3(map.phi2(map.phi1(ec)))));
// idedge = map.getNewEdgeId();
// map.setEdgeId(ec, idedge, EDGE_ORBIT);
*/
include/Algo/Import/import.h
View file @
cd6c1705
...
...
@@ -71,12 +71,6 @@ bool importTet(typename PFP::MAP& the_map, const std::string& filename, std::vec
template
<
typename
PFP
>
bool
importTs
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
template
<
typename
PFP
>
bool
importInESSSurfacique
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
std
::
vector
<
std
::
pair
<
typename
PFP
::
VEC3
,
typename
PFP
::
VEC3
>
>&
influences
);
template
<
typename
PFP
>
bool
importInESSVolumique
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
}
// namespace Import
...
...
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
View file @
cd6c1705
...
...
@@ -489,6 +489,79 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d)
return
subd
;
}
bool
ImplicitHierarchicalMap3
::
edgeCanBeCoarsened
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
bool
subd
=
false
;
bool
subdOnce
=
true
;
bool
degree2
=
false
;
if
(
edgeIsSubdivided
(
d
))
{
subd
=
true
;
Dart
d2
=
phi2
(
d
)
;
++
m_curLevel
;
if
(
vertexDegree
(
phi1
(
d
))
==
2
)
{
degree2
=
true
;
if
(
edgeIsSubdivided
(
d
)
||
edgeIsSubdivided
(
d2
))
subdOnce
=
false
;
}
--
m_curLevel
;
}
return
subd
&&
degree2
&&
subdOnce
;
}
bool
ImplicitHierarchicalMap3
::
faceIsSubdividedOnce
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
unsigned
int
fLevel
=
faceLevel
(
d
)
;
if
(
fLevel
<
m_curLevel
)
// a face whose level in the current level map is lower than
return
false
;
// the current level can not be subdivided to higher levels
unsigned
int
degree
=
0
;
bool
subd
=
false
;
bool
subdOnce
=
true
;
Dart
fit
=
d
;
do
{
++
m_curLevel
;
if
(
m_dartLevel
[
phi1
(
fit
)]
==
m_curLevel
&&
m_edgeId
[
phi1
(
fit
)]
!=
m_edgeId
[
fit
])
{
subd
=
true
;
++
m_curLevel
;
if
(
m_dartLevel
[
phi1
(
fit
)]
==
m_curLevel
&&
m_edgeId
[
phi1
(
fit
)]
!=
m_edgeId
[
fit
])
subdOnce
=
false
;
--
m_curLevel
;
}
--
m_curLevel
;
++
degree
;
fit
=
phi1
(
fit
)
;
}
while
(
subd
&&
subdOnce
&&
fit
!=
d
)
;
if
(
degree
==
3
&&
subd
)
{
++
m_curLevel
;
Dart
cf
=
phi2
(
phi1
(
d
))
;
++
m_curLevel
;
if
(
m_dartLevel
[
phi1
(
cf
)]
==
m_curLevel
&&
m_edgeId
[
phi1
(
cf
)]
!=
m_edgeId
[
cf
])
subdOnce
=
false
;
--
m_curLevel
;
--
m_curLevel
;
}
return
subd
&&
subdOnce
;
}
bool
ImplicitHierarchicalMap3
::
volumeIsSubdividedOnce
(
Dart
d
)
{
return
true
;
}
}
//namespace IHM
}
//namespace Algo
...
...
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