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
6a58a080
Commit
6a58a080
authored
Nov 06, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dual Regular subdivision + removeFrontLevel() in an MR map
parent
ea93f7ca
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
449 additions
and
72 deletions
+449
-72
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+1
-0
include/Algo/Multiresolution/Map2MR/Filters/Dual/catmullClark.h
...e/Algo/Multiresolution/Map2MR/Filters/Dual/catmullClark.h
+137
-0
include/Algo/Multiresolution/Map2MR/Filters/catmullClark.h
include/Algo/Multiresolution/Map2MR/Filters/catmullClark.h
+1
-1
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
+92
-0
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
+154
-0
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.h
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.h
+3
-1
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.hpp
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.hpp
+13
-0
include/Topology/map/embeddedMap2.h
include/Topology/map/embeddedMap2.h
+1
-12
include/Topology/map/map2.h
include/Topology/map/map2.h
+1
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+27
-1
src/Topology/map/embeddedMap2.cpp
src/Topology/map/embeddedMap2.cpp
+7
-50
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+5
-5
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+7
-1
No files found.
Apps/Tuto/tuto_oper3.cpp
View file @
6a58a080
...
...
@@ -330,6 +330,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
d
!=
Dart
::
nil
())
m_selected
=
d
;
std
::
cout
<<
myMap
.
edgeCanCollapse
(
d
)
<<
std
::
endl
;
}
if
(
button
==
Qt
::
RightButton
)
{
...
...
include/Algo/Multiresolution/Map2MR/Filters/Dual/catmullClark.h
0 → 100644
View file @
6a58a080
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MR_CC_MASK__
#define __MR_CC_MASK__
#include <cmath>
namespace
CGoGN
{
namespace
Algo
{
namespace
MR
{
namespace
Dual
{
namespace
Filters
{
template
<
typename
PFP
>
class
CCVertexSynthesisFilter
:
public
Filter
{
protected:
typename
PFP
::
MAP
&
m_map
;
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
public:
CCVertexSynthesisFilter
(
typename
PFP
::
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
void
operator
()
()
{
TraversorV
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
dV
=
trav
.
begin
();
dV
!=
trav
.
end
();
dV
=
trav
.
next
())
{
m_map
.
incCurrentLevel
()
;
Dart
start
=
m_map
.
phi2
(
m_map
.
phi1
(
m_map
.
phi2
(
dV
)));
Dart
dit
=
start
;
do
{
Dart
d
=
m_map
.
phi1
(
m_map
.
phi2
(
m_map
.
phi1
(
m_map
.
phi2
(
dit
))));
unsigned
int
degree
=
m_map
.
faceDegree
(
d
);
typename
PFP
::
VEC3
p
(
0.0
);
typename
PFP
::
REAL
a0
=
1.0
/
2.0
+
1.0
/
(
4.0
*
typename
PFP
::
REAL
(
degree
));
typename
PFP
::
REAL
a1
=
1.0
/
8.0
+
1.0
/
(
4.0
*
typename
PFP
::
REAL
(
degree
));
typename
PFP
::
REAL
ak_1
=
a1
;
if
(
degree
==
3
)
{
p
+=
a0
*
m_position
[
d
]
+
a1
*
m_position
[
m_map
.
phi1
(
d
)]
+
ak_1
*
m_position
[
m_map
.
phi_1
(
d
)];
m_map
.
incCurrentLevel
();
m_position
[
d
]
=
p
;
m_map
.
decCurrentLevel
();
}
else
if
(
degree
==
4
)
{
typename
PFP
::
REAL
a2
=
1.0
/
(
4.0
*
typename
PFP
::
REAL
(
degree
));
p
+=
a0
*
m_position
[
d
]
+
a1
*
m_position
[
m_map
.
phi1
(
d
)]
+
a2
*
m_position
[
m_map
.
phi1
(
m_map
.
phi1
(
d
))]
+
ak_1
*
m_position
[
m_map
.
phi_1
(
d
)];
m_map
.
incCurrentLevel
();
m_position
[
d
]
=
p
;
}
else
{
p
+=
a0
*
m_position
[
d
]
+
a1
*
m_position
[
m_map
.
phi1
(
d
)];
Dart
end
=
m_map
.
phi_1
(
m_map
.
phi_1
(
d
));
Dart
dit
=
m_map
.
phi1
(
m_map
.
phi1
(
d
));
do
{
typename
PFP
::
REAL
ai
=
1.0
/
(
4.0
*
typename
PFP
::
REAL
(
degree
));
p
+=
ai
*
m_position
[
dit
];
dit
=
m_map
.
phi1
(
dit
);
}
while
(
dit
!=
end
);
p
+=
ak_1
*
m_position
[
m_map
.
phi_1
(
d
)];
m_map
.
incCurrentLevel
();
m_position
[
d
]
=
p
;
}
dit
=
m_map
.
phi1
(
dit
);
}
while
(
dit
!=
start
);
}
m_map
.
decCurrentLevel
();
}
}
;
}
// namespace Masks
}
// namespace Primal
}
// namespace MR
}
// namespace Algo
}
// namespace CGoGN
#endif
include/Algo/Multiresolution/Map2MR/Filters/catmullClark.h
View file @
6a58a080
...
...
@@ -408,7 +408,7 @@ public:
e
*=
u
/
degree
;
m_map
.
incCurrentLevel
()
;
m_position
[
m_map
.
phi2
(
m_map
.
phi1
(
d
))]
-
=
v
-
e
;
m_position
[
m_map
.
phi2
(
m_map
.
phi1
(
d
))]
=
m_position
[
m_map
.
phi2
(
m_map
.
phi1
(
d
))]
-
v
-
e
;
m_map
.
decCurrentLevel
()
;
}
...
...
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
0 → 100644
View file @
6a58a080
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MAP2MR_DUAL_REGULAR__
#define __MAP2MR_DUAL_REGULAR__
#include "Topology/map/embeddedMap2.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Algo/Multiresolution/filter.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
MR
{
namespace
Dual
{
namespace
Regular
{
template
<
typename
PFP
>
class
Map2MR
{
public:
typedef
typename
PFP
::
MAP
MAP
;
protected:
MAP
&
m_map
;
bool
shareVertexEmbeddings
;
std
::
vector
<
Filter
*>
synthesisFilters
;
std
::
vector
<
Filter
*>
analysisFilters
;
public:
Map2MR
(
MAP
&
map
);
~
Map2MR
();
//if true : tri and quad else quad
void
addNewLevel
(
bool
embedNewVertices
=
true
)
;
void
addSynthesisFilter
(
Filter
*
f
)
{
synthesisFilters
.
push_back
(
f
)
;
}
void
addAnalysisFilter
(
Filter
*
f
)
{
analysisFilters
.
push_back
(
f
)
;
}
void
clearSynthesisFilters
()
{
synthesisFilters
.
clear
()
;
}
void
clearAnalysisFilters
()
{
analysisFilters
.
clear
()
;
}
void
analysis
()
;
void
synthesis
()
;
}
;
}
// namespace Regular
}
// namespace Dual
}
// namespace MR
}
// namespace Algo
}
// namespace CGoGN
#include "Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp"
#endif
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
0 → 100644
View file @
6a58a080
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace
CGoGN
{
namespace
Algo
{
namespace
MR
{
namespace
Dual
{
namespace
Regular
{
template
<
typename
PFP
>
Map2MR
<
PFP
>::
Map2MR
(
typename
PFP
::
MAP
&
map
)
:
m_map
(
map
),
shareVertexEmbeddings
(
true
)
{
}
template
<
typename
PFP
>
Map2MR
<
PFP
>::~
Map2MR
()
{
unsigned
int
level
=
m_map
.
getCurrentLevel
();
unsigned
int
maxL
=
m_map
.
getMaxLevel
();
for
(
unsigned
int
i
=
maxL
;
i
>
level
;
--
i
)
m_map
.
removeLevelBack
();
for
(
unsigned
int
i
=
0
;
i
<
level
;
++
i
)
m_map
.
removeLevelFront
();
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
addNewLevel
(
bool
embedNewVertices
)
{
m_map
.
pushLevel
()
;
m_map
.
addLevelBack
()
;
m_map
.
duplicateDarts
(
m_map
.
getMaxLevel
());
m_map
.
setCurrentLevel
(
m_map
.
getMaxLevel
()
-
1
)
;
TraversorV
<
typename
PFP
::
MAP
>
travV
(
m_map
)
;
for
(
Dart
d
=
travV
.
begin
();
d
!=
travV
.
end
();
d
=
travV
.
next
())
{
//create new faces in the previous edges
unsigned
int
count
=
0
;
Dart
ditv
=
d
;
do
{
Dart
d2
=
m_map
.
phi2
(
ditv
);
m_map
.
incCurrentLevel
();
if
(
m_map
.
phi2
(
d
)
==
d2
)
{
m_map
.
unsewFaces
(
d
,
false
);
Dart
nf
=
m_map
.
newFace
(
4
,
false
);
m_map
.
sewFaces
(
nf
,
d
,
false
);
m_map
.
sewFaces
(
m_map
.
phi1
(
m_map
.
phi1
(
nf
)),
d2
,
false
);
}
m_map
.
decCurrentLevel
();
++
count
;
ditv
=
m_map
.
phi2
(
m_map
.
phi_1
(
ditv
));
}
while
(
ditv
!=
d
);
// // create new faces in the previous vertices
// Dart nf = m_map.newFace(count,false);
// do
// {
// m_map.incCurrentLevel();
//
// Dart d21 = m_map.phi1(m_map.phi2(ditv));
// m_map.sewFaces(nf,d21,false);
//
// if(embedNewVertices)
// m_map.template embedNewCell<VERTEX>(nf) ;
//
// nf = m_map.phi1(nf);
//
// m_map.decCurrentLevel();
//
//
// ditv = m_map.phi2(m_map.phi_1(ditv));
// }while(ditv != d);
}
m_map
.
popLevel
()
;
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
analysis
()
{
assert
(
m_map
.
getCurrentLevel
()
>
0
||
!
"analysis : called on level 0"
)
;
m_map
.
decCurrentLevel
()
;
for
(
unsigned
int
i
=
0
;
i
<
analysisFilters
.
size
();
++
i
)
(
*
analysisFilters
[
i
])()
;
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
synthesis
()
{
assert
(
m_map
.
getCurrentLevel
()
<
m_map
.
getMaxLevel
()
||
!
"synthesis : called on max level"
)
;
for
(
unsigned
int
i
=
0
;
i
<
synthesisFilters
.
size
();
++
i
)
(
*
synthesisFilters
[
i
])()
;
m_map
.
incCurrentLevel
()
;
}
}
// namespace Regular
}
// namespace Dual
}
// namespace MR
}
// namespace Algo
}
// namespace CGoGN
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.h
View file @
6a58a080
...
...
@@ -60,7 +60,9 @@ protected:
std
::
vector
<
Filter
*>
analysisFilters
;
public:
Map2MR
(
MAP
&
map
)
;
Map2MR
(
MAP
&
map
);
~
Map2MR
();
//if true : tri and quad else quad
void
addNewLevel
(
bool
triQuad
=
true
,
bool
embedNewVertices
=
true
)
;
...
...
include/Algo/Multiresolution/Map2MR/map2MR_PrimalRegular.hpp
View file @
6a58a080
...
...
@@ -45,6 +45,19 @@ Map2MR<PFP>::Map2MR(typename PFP::MAP& map) :
}
template
<
typename
PFP
>
Map2MR
<
PFP
>::~
Map2MR
()
{
unsigned
int
level
=
m_map
.
getCurrentLevel
();
unsigned
int
maxL
=
m_map
.
getMaxLevel
();
for
(
unsigned
int
i
=
maxL
;
i
>
level
;
--
i
)
m_map
.
removeLevelBack
();
for
(
unsigned
int
i
=
0
;
i
<
level
;
++
i
)
m_map
.
removeLevelFront
();
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
addNewLevel
(
bool
triQuad
,
bool
embedNewVertices
)
{
...
...
include/Topology/map/embeddedMap2.h
View file @
6a58a080
...
...
@@ -89,17 +89,6 @@ public:
*
*/
virtual
void
swapEdges
(
Dart
d
,
Dart
e
);
// /**
// * The attributes attached to the vertex of dart d are kept on the resulting vertex
// * The attributes attached to the face of dart d are overwritten on the face of dart e
// */
// virtual void insertEdgeInVertex(Dart d, Dart e);
//
// /**
// * The attributes attached to the vertex of dart d are kept on the resulting vertex
// * The attributes attached to the face of dart d are overwritten on the face of dart e
// */
// virtual void removeEdgeFromVertex(Dart d);
/**
* The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge
...
...
@@ -111,7 +100,7 @@ public:
* The attributes attached to the vertices of the old edge of d are duplicated on the vertices of both resulting edges
* The attributes attached to the old edge are duplicated on both resulting edges
*/
virtual
void
unsewFaces
(
Dart
d
)
;
virtual
void
unsewFaces
(
Dart
d
,
bool
withBoundary
=
true
)
;
/**
* The attributes attached to the edge of d are kept on the resulting edge
...
...
include/Topology/map/map2.h
View file @
6a58a080
...
...
@@ -228,7 +228,7 @@ public:
/*! \pre Edge of dart d MUST NOT be a boundary edge
* @param d a dart of a face
*/
virtual
void
unsewFaces
(
Dart
d
);
virtual
void
unsewFaces
(
Dart
d
,
bool
withBoundary
=
true
);
//! Delete an oriented face if and only if it has one or two edges
/*! If the face is sewed to two distinct adjacent faces,
...
...
src/Topology/generic/genericmap.cpp
View file @
6a58a080
...
...
@@ -283,7 +283,33 @@ void GenericMap::removeLevelBack()
void
GenericMap
::
removeLevelFront
()
{
std
::
cout
<<
"TO DO"
<<
std
::
endl
;
unsigned
int
maxL
=
getMaxLevel
()
;
if
(
maxL
>
0
)
//must have at min 2 levels (0 and 1) to remove the front one
{
AttributeMultiVector
<
unsigned
int
>*
minMR
=
m_mrDarts
[
0
]
;
AttributeMultiVector
<
unsigned
int
>*
firstMR
=
m_mrDarts
[
1
]
;
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
unsigned
int
idx
=
(
*
minMR
)[
i
]
;
if
((
*
m_mrLevels
)[
i
]
!=
0
)
// if the MRdart was introduced after the level we're removing
{
--
(
*
m_mrLevels
)[
i
];
//decrement his level of insertion
}
else
// if the dart was introduced on a this level and not used after
{
// if(idx != (*firstMR)[i]) // delete the pointed dart line only if
// deleteDartLine(idx) ; // it is not shared with next level
}
}
m_mrNbDarts
[
1
]
+=
m_mrNbDarts
[
0
];
m_mrattribs
.
removeAttribute
<
unsigned
int
>
(
minMR
->
getIndex
())
;
m_mrDarts
.
erase
(
m_mrDarts
.
begin
())
;
m_mrNbDarts
.
erase
(
m_mrNbDarts
.
begin
())
;
--
m_mrCurrentLevel
;
}
}
void
GenericMap
::
copyLevel
(
unsigned
int
level
)
...
...
src/Topology/map/embeddedMap2.cpp
View file @
6a58a080
...
...
@@ -231,55 +231,6 @@ void EmbeddedMap2::swapEdges(Dart d, Dart e)
embedNewCell
<
VOLUME
>
(
d
);
}
//void EmbeddedMap2::insertEdgeInVertex(Dart d, Dart e)
//{
// Map2::insertEdgeInVertex(d, e);
//
// if (isOrbitEmbedded<VERTEX>())
// {
// copyDartEmbedding<VERTEX>(e, d) ;
// }
//
// if (isOrbitEmbedded<FACE>())
// {
// if(!sameFace(d,e))
// {
// embedNewCell<FACE>(e);
// copyCell<FACE>(e, d) ;
// }
// else
// {
// embedOrbit<FACE>(d, getEmbedding<FACE>(d)) ;
// }
// }
//}
//
//void EmbeddedMap2::removeEdgeFromVertex(Dart d)
//{
// Dart dPrev = alpha_1(d);
//
// Map2::removeEdgeFromVertex(d);
//
// if (isOrbitEmbedded<VERTEX>())
// {
// embedNewCell<VERTEX>(d);
// copyCell<VERTEX>(d, dPrev);
// }
//
// if (isOrbitEmbedded<FACE>())
// {
// if(!sameFace(d, dPrev))
// {
// embedNewCell<FACE>(d);
// copyCell<FACE>(d, dPrev) ;
// }
// else
// {
// embedOrbit<FACE>(d, getEmbedding<FACE>(d)) ;
// }
// }
//}
void
EmbeddedMap2
::
sewFaces
(
Dart
d
,
Dart
e
,
bool
withBoundary
)
{
if
(
!
withBoundary
)
...
...
@@ -302,8 +253,14 @@ void EmbeddedMap2::sewFaces(Dart d, Dart e, bool withBoundary)
}
}
void
EmbeddedMap2
::
unsewFaces
(
Dart
d
)
void
EmbeddedMap2
::
unsewFaces
(
Dart
d
,
bool
withBoundary
)
{
if
(
!
withBoundary
)
{
Map2
::
unsewFaces
(
d
,
false
)
;
return
;
}
Dart
e
=
phi2
(
d
)
;
Map2
::
unsewFaces
(
d
)
;
...
...
src/Topology/map/embeddedMap3.cpp
View file @
6a58a080
...
...
@@ -155,11 +155,11 @@ Dart EmbeddedMap3::deleteEdge(Dart d)
bool
EmbeddedMap3
::
edgeCanCollapse
(
Dart
d
)
{
if
(
isBoundaryVertex
(
d
)
||
isBoundaryVertex
(
phi1
(
d
)))
return
false
;
if
(
isBoundaryEdge
(
d
))
return
false
;
//
if(isBoundaryVertex(d) || isBoundaryVertex(phi1(d)))
//
return false;
//
//
if(isBoundaryEdge(d))
//
return false;
CellMarkerStore
<
VERTEX
>
mv
(
*
this
);
...
...
src/Topology/map/map2.cpp
View file @
6a58a080
...
...
@@ -367,8 +367,14 @@ void Map2::sewFaces(Dart d, Dart e, bool withBoundary)
phi2sew
(
d
,
e
)
;
// sew the faces