Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KennethVanhoey
CGoGN
Commits
11df28e3
Commit
11df28e3
authored
Mar 08, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MR : updates in adaptive primal subdivision
parent
2cf2e5ff
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
195 additions
and
86 deletions
+195
-86
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+1
-1
include/Algo/Import/importMRDAT.h
include/Algo/Import/importMRDAT.h
+1
-1
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+2
-2
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+7
-3
include/Topology/map/map2MR/filters_Primal.h
include/Topology/map/map2MR/filters_Primal.h
+0
-1
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
+8
-7
include/Topology/map/map2MR/map2MR_PrimalRegular.h
include/Topology/map/map2MR/map2MR_PrimalRegular.h
+1
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+5
-5
src/Topology/map/map2MR/map2MR_PrimalAdapt.cpp
src/Topology/map/map2MR/map2MR_PrimalAdapt.cpp
+163
-58
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
+7
-7
No files found.
include/Algo/Geometry/centroid.hpp
View file @
11df28e3
...
...
@@ -42,7 +42,7 @@ template <typename PFP, typename EMBV, typename EMB>
EMB
volumeCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
()
;
unsigned
count
=
0
;
unsigned
int
count
=
0
;
Traversor3WV
<
typename
PFP
::
MAP
>
tra
(
map
,
d
);
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
...
...
include/Algo/Import/importMRDAT.h
View file @
11df28e3
...
...
@@ -84,7 +84,7 @@ public:
{
unsigned
int
v0
=
vID
[
indices
[
0
]]
;
unsigned
int
v1
=
vID
[
indices
[
1
]]
;
unsigned
int
v2
=
vID
[
indices
[
2
]]
;
//
unsigned int v2 = vID[indices[2]] ;
Dart
it
=
d
;
do
...
...
include/Topology/generic/genericmap.h
View file @
11df28e3
...
...
@@ -119,12 +119,12 @@ protected:
AttributeContainer
m_mrattribs
;
/**
* pointers to attributes that store indices in m_attribs[DART] (one for each level)
* pointers to attributes
of m_mrattribs
that store indices in m_attribs[DART] (one for each level)
*/
std
::
vector
<
AttributeMultiVector
<
unsigned
int
>*
>
m_mrDarts
;
/**
* pointer to attribute that stores darts insertion levels
* pointer to attribute
of m_mrattribs
that stores darts insertion levels
*/
AttributeMultiVector
<
unsigned
int
>*
m_mrLevels
;
...
...
include/Topology/generic/genericmap.hpp
View file @
11df28e3
...
...
@@ -96,8 +96,13 @@ inline Dart GenericMap::newDart()
for
(
unsigned
int
i
=
0
;
i
<
m_mrCurrentLevel
;
++
i
)
// for all previous levels
(
*
m_mrDarts
[
i
])[
mrdi
]
=
MRNULL
;
// this MRdart does not exist
for
(
unsigned
int
i
=
m_mrCurrentLevel
;
i
<
m_mrDarts
.
size
();
++
i
)
// for all levels from current to max
(
*
m_mrDarts
[
i
])[
mrdi
]
=
di
;
// make this MRdart points to the new dart line
// for(unsigned int i = m_mrCurrentLevel; i < m_mrDarts.size(); ++i) // for all levels from current to max
// (*m_mrDarts[i])[mrdi] = di ; // make this MRdart point to the new dart line
(
*
m_mrDarts
[
m_mrCurrentLevel
])[
mrdi
]
=
di
;
// for the current level, this MRdart points to the new dart line
for
(
unsigned
int
i
=
m_mrCurrentLevel
+
1
;
i
<
m_mrDarts
.
size
();
++
i
)
// for all levels from current + 1 to max
(
*
m_mrDarts
[
i
])[
mrdi
]
=
copyDartLine
(
di
)
;
// make this MRdart point to a copy of the new dart line
return
Dart
::
create
(
mrdi
)
;
}
...
...
@@ -156,7 +161,6 @@ inline unsigned int GenericMap::copyDartLine(unsigned int index)
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
(
m_embeddings
[
orbit
])
// (*m_embeddings[orbit])[newindex] = EMBNULL ;
{
unsigned
int
emb
=
(
*
m_embeddings
[
orbit
])[
newindex
]
;
// add a ref to the cells pointed
if
(
emb
!=
EMBNULL
)
// by the new dart line
...
...
include/Topology/map/map2MR/filters_Primal.h
View file @
11df28e3
...
...
@@ -41,7 +41,6 @@ public:
virtual
void
operator
()
()
=
0
;
}
;
/*********************************************************************************
* LOOP BASIC FUNCTIONS
*********************************************************************************/
...
...
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
View file @
11df28e3
...
...
@@ -104,15 +104,18 @@ public:
* SUBDIVISION *
***************************************************/
protected:
// void propagatePhi1(Dart d) ;
// void propagatePhi_1(Dart d) ;
/**
* add a new resolution level
*/
void
addNewLevel
()
;
void
addNewLevel
(
bool
embedNewVertices
=
true
)
;
void
propagateDartRelation
(
Dart
d
,
AttributeMultiVector
<
Dart
>*
rel
)
;
void
propagateDartEmbedding
(
Dart
d
,
unsigned
int
orbit
)
;
void
propagateOrbitEmbedding
(
Dart
d
,
unsigned
int
orbit
)
;
Dart
cutEdge
(
Dart
d
)
;
void
splitFace
(
Dart
d
,
Dart
e
)
;
protected:
/**
* subdivide the edge of d to the next level
*/
...
...
@@ -138,9 +141,7 @@ public:
* vertices attributes management
*/
void
setVertexVertexFunctor
(
FunctorType
*
f
)
{
vertexVertexFunctor
=
f
;
}
void
setEdgeVertexFunctor
(
FunctorType
*
f
)
{
edgeVertexFunctor
=
f
;
}
void
setFaceVertexFunctor
(
FunctorType
*
f
)
{
faceVertexFunctor
=
f
;
}
}
;
...
...
include/Topology/map/map2MR/map2MR_PrimalRegular.h
View file @
11df28e3
...
...
@@ -47,7 +47,7 @@ public:
std
::
string
mapTypeName
()
{
return
"Map2MR_PrimalRegular"
;
}
void
addNewLevel
(
bool
embedNewVertices
)
;
void
addNewLevel
(
bool
embedNewVertices
=
true
)
;
void
addSynthesisFilter
(
Multiresolution
::
MRFilter
*
f
)
{
synthesisFilters
.
push_back
(
f
)
;
}
void
addAnalysisFilter
(
Multiresolution
::
MRFilter
*
f
)
{
analysisFilters
.
push_back
(
f
)
;
}
...
...
src/Topology/generic/genericmap.cpp
View file @
11df28e3
...
...
@@ -202,11 +202,11 @@ void GenericMap::addLevel()
AttributeMultiVector
<
unsigned
int
>*
prevAttrib
=
m_mrDarts
[
newLevel
-
1
]
;
// copy the indices of
m_mrattribs
.
copyAttribute
(
newAttrib
->
getIndex
(),
prevAttrib
->
getIndex
())
;
// previous level into new level
//
for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
//
{
//
unsigned int oldi = (*prevAttrib)[i] ; // get the index of the dart in previous level
//
(*newAttrib)[i] = copyDartLine(oldi) ; // copy the dart and affect it to the new level
//
}
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
unsigned
int
oldi
=
(
*
prevAttrib
)[
i
]
;
// get the index of the dart in previous level
(
*
newAttrib
)[
i
]
=
copyDartLine
(
oldi
)
;
// copy the dart and affect it to the new level
}
}
}
...
...
src/Topology/map/map2MR/map2MR_PrimalAdapt.cpp
View file @
11df28e3
...
...
@@ -250,61 +250,166 @@ bool Map2MR_PrimalAdapt::faceIsSubdividedOnce(Dart d)
* SUBDIVISION *
***************************************************/
//void Map2MR_PrimalAdapt::propagatePhi1(Dart d)
void
Map2MR_PrimalAdapt
::
addNewLevel
(
bool
embedNewVertices
)
{
pushLevel
()
;
addLevel
()
;
setCurrentLevel
(
getMaxLevel
())
;
// for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
// {
// unsigned int newindex = copyDartLine((*m_mrDarts[m_mrCurrentLevel])[i]) ; // duplicate all darts
// (*m_mrDarts[m_mrCurrentLevel])[i] = newindex ; // on the new max level
// if(!shareVertexEmbeddings)
// (*m_embeddings[VERTEX])[newindex] = EMBNULL ; // set vertex embedding to EMBNULL if no sharing
// }
popLevel
()
;
}
void
Map2MR_PrimalAdapt
::
propagateDartRelation
(
Dart
d
,
AttributeMultiVector
<
Dart
>*
rel
)
{
Dart
dd
=
(
*
rel
)[
dartIndex
(
d
)]
;
pushLevel
()
;
for
(
unsigned
int
i
=
getCurrentLevel
()
+
1
;
i
<=
getMaxLevel
();
++
i
)
{
setCurrentLevel
(
i
)
;
(
*
rel
)[
dartIndex
(
d
)]
=
dd
;
}
popLevel
()
;
}
void
Map2MR_PrimalAdapt
::
propagateDartEmbedding
(
Dart
d
,
unsigned
int
orbit
)
{
unsigned
int
emb
=
getEmbedding
(
orbit
,
d
)
;
pushLevel
()
;
for
(
unsigned
int
i
=
getCurrentLevel
()
+
1
;
i
<=
getMaxLevel
();
++
i
)
{
setCurrentLevel
(
i
)
;
setDartEmbedding
(
orbit
,
d
,
emb
)
;
}
popLevel
()
;
}
void
Map2MR_PrimalAdapt
::
propagateOrbitEmbedding
(
Dart
d
,
unsigned
int
orbit
)
{
unsigned
int
emb
=
getEmbedding
(
orbit
,
d
)
;
pushLevel
()
;
for
(
unsigned
int
i
=
getCurrentLevel
()
+
1
;
i
<=
getMaxLevel
();
++
i
)
{
setCurrentLevel
(
i
)
;
embedOrbit
(
orbit
,
d
,
emb
)
;
}
popLevel
()
;
}
//Dart Map2MR_PrimalAdapt::cutEdge(Dart d)
//{
//
assert(getDartLevel(d) <= getCurrentLevel() || !"propagatePhi1 : called with a dart inserted after current level"
) ;
//
Dart dd = phi2(d
) ;
//
//
if(getCurrentLevel() == getMaxLevel())
//
return
;
//
Dart d1 = newDart() ;
//
Dart dd1 = newDart()
;
//
// bool finished = false ;
// unsigned int i = getCurrentLevel() + 1 ;
// do
// pushLevel() ;
// for(unsigned int i = getCurrentLevel(); i <= getMaxLevel(); ++i)
// {
// unsigned int prevdi = (*m_mrDarts[i - 1])[d.index] ;
// unsigned int curdi = (*m_mrDarts[i])[d.index] ;
// if(curdi != prevdi)
// (*m_phi1)[curdi] = (*m_phi1)[prevdi] ;
// else
// finished = true ;
// ++i ;
// if(i > getMaxLevel())
// finished = true ;
// } while(!finished) ;
//}
// setCurrentLevel(i) ;
//
// phi2unsew(d) ;
//
// phi1sew(d, d1) ;
// if (isBoundaryMarked(d))
// boundaryMark(d1) ;
//
//void Map2MR_PrimalAdapt::propagatePhi_1(Dart d)
// phi1sew(dd, dd1) ;
// if (isBoundaryMarked(dd))
// boundaryMark(dd1) ;
//
// phi2sew(d, dd1) ;
// phi2sew(dd, d1) ;
// }
// popLevel() ;
//
// return d1 ;
//}
Dart
Map2MR_PrimalAdapt
::
cutEdge
(
Dart
d
)
{
Dart
dd
=
phi2
(
d
)
;
Dart
d1
=
EmbeddedMap2
::
cutEdge
(
d
)
;
Dart
dd1
=
phi1
(
dd
)
;
Dart
d11
=
phi1
(
d1
)
;
Dart
dd11
=
phi1
(
dd1
)
;
propagateDartRelation
(
d
,
m_phi1
)
;
propagateDartRelation
(
d
,
m_phi2
)
;
propagateDartRelation
(
dd
,
m_phi1
)
;
propagateDartRelation
(
dd
,
m_phi2
)
;
propagateDartRelation
(
d1
,
m_phi1
)
;
propagateDartRelation
(
d1
,
m_phi_1
)
;
propagateDartRelation
(
d1
,
m_phi2
)
;
propagateDartRelation
(
dd1
,
m_phi1
)
;
propagateDartRelation
(
dd1
,
m_phi_1
)
;
propagateDartRelation
(
dd1
,
m_phi2
)
;
propagateDartRelation
(
d11
,
m_phi_1
)
;
propagateDartRelation
(
dd11
,
m_phi_1
)
;
return
d1
;
}
//void Map2MR_PrimalAdapt::splitFace(Dart d, Dart e)
//{
// assert(getDartLevel(d) <= getCurrentLevel() || !"propagatePhi_1 : called with a dart inserted after current level") ;
// Dart dprev = phi_1(d) ;
// Dart eprev = phi_1(e) ;
//
//
if(getCurrentLevel() == getMaxLevel())
//
return
;
//
Dart dd = newDart() ;
//
Dart ee = newDart()
;
//
// bool finished = false ;
// unsigned int i = getCurrentLevel() + 1 ;
// do
// pushLevel() ;
// for(unsigned int i = getCurrentLevel(); i <= getMaxLevel(); ++i)
// {
// unsigned int prevdi = (*m_mrDarts[i - 1])[d.index] ;
// unsigned int curdi = (*m_mrDarts[i])[d.index] ;
// if(curdi != prevdi)
// (*m_phi_1)[curdi] = (*m_phi_1)[prevdi] ;
// else
// finished = true ;
// ++i ;
// if(i > getMaxLevel())
// finished = true ;
// } while(!finished) ;
// setCurrentLevel(i) ;
//
// phi1sew(dprev, dd) ;
// if (isBoundaryMarked(dprev))
// boundaryMark(dd);
//
// phi1sew(eprev, ee) ;
// if (isBoundaryMarked(eprev))
// boundaryMark(ee);
//
// phi1sew(dprev, eprev) ;
//
// phi2sew(dd, ee) ;
//
// copyDartEmbedding(VERTEX, ee, d) ;
// copyDartEmbedding(VERTEX, dd, e) ;
// }
// popLevel() ;
//}
void
Map2MR_PrimalAdapt
::
addNewLevel
(
)
void
Map2MR_PrimalAdapt
::
splitFace
(
Dart
d
,
Dart
e
)
{
addLevel
()
;
if
(
shareVertexEmbeddings
)
{
}
else
{
}
Dart
dprev
=
phi_1
(
d
)
;
Dart
eprev
=
phi_1
(
e
)
;
EmbeddedMap2
::
splitFace
(
d
,
e
)
;
Dart
dd
=
phi1
(
dprev
)
;
Dart
ee
=
phi1
(
eprev
)
;
propagateDartRelation
(
d
,
m_phi_1
)
;
propagateDartRelation
(
e
,
m_phi_1
)
;
propagateDartRelation
(
dd
,
m_phi1
)
;
propagateDartRelation
(
dd
,
m_phi_1
)
;
propagateDartRelation
(
dd
,
m_phi2
)
;
propagateDartRelation
(
ee
,
m_phi1
)
;
propagateDartRelation
(
ee
,
m_phi_1
)
;
propagateDartRelation
(
ee
,
m_phi2
)
;
propagateDartRelation
(
dprev
,
m_phi1
)
;
propagateDartRelation
(
eprev
,
m_phi1
)
;
propagateDartEmbedding
(
dd
,
VERTEX
)
;
propagateDartEmbedding
(
ee
,
VERTEX
)
;
}
void
Map2MR_PrimalAdapt
::
subdivideEdge
(
Dart
d
)
...
...
@@ -316,19 +421,12 @@ void Map2MR_PrimalAdapt::subdivideEdge(Dart d)
incCurrentLevel
()
;
duplicateDart
(
d
)
;
Dart
dd
=
phi2
(
d
)
;
duplicateDart
(
dd
)
;
Dart
d1
=
phi1
(
d
)
;
duplicateDart
(
d1
)
;
Dart
dd1
=
phi1
(
dd
)
;
duplicateDart
(
dd1
)
;
Dart
d1
=
cutEdge
(
d
)
;
Dart
dd1
=
phi2
(
d
)
;
cutEdge
(
d
)
;
(
*
edgeVertexFunctor
)(
phi1
(
d
))
;
(
*
edgeVertexFunctor
)(
d1
)
;
propagateDartEmbedding
(
d1
,
VERTEX
)
;
propagateDartEmbedding
(
dd1
,
VERTEX
)
;
decCurrentLevel
()
;
}
...
...
@@ -366,9 +464,9 @@ unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
do
{
++
degree
;
// compute the degree of the face
Dart
nf
=
phi2
(
it
)
;
if
(
faceLevel
(
nf
)
==
fLevel
-
1
)
// check if neighboring faces have to be subdivided first
subdivideFace
(
nf
)
;
//
Dart nf = phi2(it) ;
//
if(faceLevel(nf) == fLevel - 1) // check if neighboring faces have to be subdivided first
//
subdivideFace(nf) ;
if
(
!
edgeIsSubdivided
(
it
))
subdivideEdge
(
it
)
;
// and cut the edges (if they are not already)
it
=
phi1
(
it
)
;
...
...
@@ -381,18 +479,21 @@ unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
Dart
dd
=
phi1
(
old
)
;
Dart
e
=
phi1
(
dd
)
;
(
*
vertexVertexFunctor
)(
e
)
;
propagateOrbitEmbedding
(
e
,
VERTEX
)
;
e
=
phi1
(
e
)
;
splitFace
(
dd
,
e
)
;
dd
=
e
;
e
=
phi1
(
dd
)
;
(
*
vertexVertexFunctor
)(
e
)
;
propagateOrbitEmbedding
(
e
,
VERTEX
)
;
e
=
phi1
(
e
)
;
splitFace
(
dd
,
e
)
;
dd
=
e
;
e
=
phi1
(
dd
)
;
(
*
vertexVertexFunctor
)(
e
)
;
propagateOrbitEmbedding
(
e
,
VERTEX
)
;
e
=
phi1
(
e
)
;
splitFace
(
dd
,
e
)
;
}
...
...
@@ -401,6 +502,7 @@ unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
Dart
dd
=
phi1
(
old
)
;
Dart
next
=
phi1
(
dd
)
;
(
*
vertexVertexFunctor
)(
next
)
;
propagateOrbitEmbedding
(
next
,
VERTEX
)
;
next
=
phi1
(
next
)
;
splitFace
(
dd
,
next
)
;
// insert a first edge
Dart
ne
=
alpha1
(
dd
)
;
...
...
@@ -409,16 +511,19 @@ unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
dd
=
phi1
(
next
)
;
(
*
vertexVertexFunctor
)(
dd
)
;
propagateOrbitEmbedding
(
dd
,
VERTEX
)
;
dd
=
phi1
(
dd
)
;
while
(
dd
!=
ne
)
// turn around the face and insert new edges
{
// linked to the central vertex
splitFace
(
phi1
(
ne
),
dd
)
;
dd
=
phi1
(
dd
)
;
(
*
vertexVertexFunctor
)(
dd
)
;
propagateOrbitEmbedding
(
dd
,
VERTEX
)
;
dd
=
phi1
(
dd
)
;
}
(
*
faceVertexFunctor
)(
phi2
(
ne
))
;
propagateOrbitEmbedding
(
phi2
(
ne
),
VERTEX
)
;
}
popLevel
()
;
...
...
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
View file @
11df28e3
...
...
@@ -40,13 +40,13 @@ void Map2MR_PrimalRegular::addNewLevel(bool embedNewVertices)
addLevel
()
;
setCurrentLevel
(
getMaxLevel
())
;
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
unsigned
int
newindex
=
copyDartLine
((
*
m_mrDarts
[
m_mrCurrentLevel
])[
i
])
;
// duplicate all darts
(
*
m_mrDarts
[
m_mrCurrentLevel
])[
i
]
=
newindex
;
// on the new max level
if
(
!
shareVertexEmbeddings
)
(
*
m_embeddings
[
VERTEX
])[
newindex
]
=
EMBNULL
;
// set vertex embedding to EMBNULL if no sharing
}
//
for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
//
{
//
unsigned int newindex = copyDartLine((*m_mrDarts[m_mrCurrentLevel])[i]) ; // duplicate all darts
//
(*m_mrDarts[m_mrCurrentLevel])[i] = newindex ; // on the new max level
//
if(!shareVertexEmbeddings)
//
(*m_embeddings[VERTEX])[newindex] = EMBNULL ; // set vertex embedding to EMBNULL if no sharing
//
}
// cut edges
TraversorE
<
Map2MR_PrimalRegular
>
travE
(
*
this
)
;
...
...
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