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
Etienne Schmitt
CGoGN
Commits
b7e8bfa8
Commit
b7e8bfa8
authored
Jun 07, 2013
by
untereiner
Browse files
begin dual volumetric subdivision
parent
6e9a3676
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/Algo/Multiresolution/Map3MR/Dual/dooSabin.h
0 → 100644
View file @
b7e8bfa8
/*******************************************************************************
* 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_DOOSABIN_MASK__
#define __MR_DOOSABIN_MASK__
#include
<cmath>
namespace
CGoGN
{
namespace
Algo
{
namespace
Volume
{
namespace
MR
{
namespace
Dual
{
namespace
Filters
{
template
<
typename
PFP
>
class
DooSabinVertexSynthesisFilter
:
public
Algo
::
MR
::
Filter
{
protected:
typename
PFP
::
MAP
&
m_map
;
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
public:
DooSabinVertexSynthesisFilter
(
typename
PFP
::
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
void
operator
()
()
{
// TraversorV<typename PFP::MAP> tv(m_map);
// for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
// {
// if(m_map.isBoundaryVertex(d))
// {
// Dart db = m_map.findBoundaryFaceOfVertex(d);
//
// typename PFP::VEC3 p(0.0);
//
// unsigned int N = m_map.faceDegree(db);
// typename PFP::REAL K0 = float(N+5)/float(4*N);//(1.0 / 4.0) + (5.0 / 4.0) * double(N);
// p += K0 * m_position[db];
// unsigned int j = 1;
// Dart tmp = m_map.phi1(db);
// do
// {
// typename PFP::REAL Kj = (3.0 + 2.0 * cos(2.0 * double(j) * M_PI / double(N))) / (4.0 * N);
// p += Kj * m_position[tmp];
// tmp = m_map.phi1(tmp);
// ++j;
// }while(tmp != db);
//
// m_map.incCurrentLevel();
//
// m_position[db] = p;
//
// m_map.decCurrentLevel();
//
// }
// else
// {
// Traversor3VW<typename PFP::MAP> tvw(m_map,d);
// for(Dart dit = tvw.begin() ; dit != tvw.end() ; dit = tvw.next())
// {
// typename PFP::VEC3 p(0.0);
// unsigned int count = 0;
//
// Dart ditface = dit;
// do
// {
// typename PFP::VEC3 tmpP(0.0);
// unsigned int N = m_map.faceDegree(ditface);
// typename PFP::REAL K0 = float(N+5)/float(4*N);//(1.0 / 4.0) + (5.0 / 4.0) * double(N);
// tmpP += K0 * m_position[ditface];
// unsigned int j = 1;
// Dart tmp = m_map.phi1(ditface);
// do
// {
// typename PFP::REAL Kj = (3.0 + 2.0 * cos(2.0 * double(j) * M_PI / double(N))) / (4.0 * N);
// tmpP += Kj * m_position[tmp];
// tmp = m_map.phi1(tmp);
// ++j;
// }while(tmp != ditface);
//
// p += tmpP;
// ++count;
// ditface = m_map.phi2(m_map.phi_1(ditface));
// }
// while(ditface != dit);
//
// p /= count;
//
// m_map.incCurrentLevel();
//
// m_position[dit] = p;
//
// m_map.decCurrentLevel();
// }
// }
// }
}
}
;
}
// namespace Masks
}
// namespace Dual
}
// namespace MR
}
// namespace Volume
}
// namespace Algo
}
// namespace CGoGN
#endif
include/Algo/Multiresolution/Map3MR/Filters/lerp.h
View file @
b7e8bfa8
...
...
@@ -363,13 +363,15 @@ public:
{
typename
PFP
::
VEC3
p
=
Algo
::
Surface
::
Geometry
::
volumeCentroid
<
PFP
>
(
m_map
,
d
,
m_position
);
m_map
.
incCurrentLevel
()
;
Dart
midV
=
m_map
.
phi_1
(
m_map
.
phi2
(
m_map
.
phi1
(
d
)));
m_position
[
midV
]
=
p
;
if
(
!
Algo
::
Volume
::
Modelisation
::
Tetrahedralization
::
isTetrahedron
<
PFP
>
(
m_map
,
d
))
{
m_map
.
incCurrentLevel
()
;
m_map
.
decCurrentLevel
()
;
Dart
midV
=
m_map
.
phi_1
(
m_map
.
phi2
(
m_map
.
phi1
(
d
)));
m_position
[
midV
]
=
p
;
m_map
.
decCurrentLevel
()
;
}
}
}
}
;
...
...
@@ -431,7 +433,6 @@ public:
m_position
[
midV
]
=
p
;
m_map
.
decCurrentLevel
()
;
}
}
}
;
...
...
include/Algo/Multiresolution/Map3MR/map3MR_DualRegular.h
0 → 100644
View file @
b7e8bfa8
/*******************************************************************************
* 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 __MAP3MR_DUAL_REGULAR__
#define __MAP3MR_DUAL_REGULAR__
#include
"Topology/map/embeddedMap3.h"
#include
"Topology/generic/traversorCell.h"
#include
"Topology/generic/traversor3.h"
#include
"Algo/Multiresolution/filter.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
Volume
{
namespace
MR
{
namespace
Dual
{
namespace
Regular
{
template
<
typename
PFP
>
class
Map3MR
{
public:
typedef
typename
PFP
::
MAP
MAP
;
protected:
MAP
&
m_map
;
bool
shareVertexEmbeddings
;
std
::
vector
<
Algo
::
MR
::
Filter
*>
synthesisFilters
;
std
::
vector
<
Algo
::
MR
::
Filter
*>
analysisFilters
;
public:
Map3MR
(
MAP
&
map
);
~
Map3MR
();
//if true : tri and quad else quad
void
addNewLevel
(
bool
embedNewVertices
=
true
)
;
void
addSynthesisFilter
(
Algo
::
MR
::
Filter
*
f
)
{
synthesisFilters
.
push_back
(
f
)
;
}
void
addAnalysisFilter
(
Algo
::
MR
::
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 Volume
}
// namespace Algo
}
// namespace CGoGN
#include
"Algo/Multiresolution/Map3MR/map3MR_DualRegular.hpp"
#endif
include/Algo/Multiresolution/Map3MR/map3MR_DualRegular.hpp
0 → 100644
View file @
b7e8bfa8
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#include
"Algo/Modelisation/polyhedron.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
Volume
{
namespace
MR
{
namespace
Dual
{
namespace
Regular
{
template
<
typename
PFP
>
Map3MR
<
PFP
>::
Map3MR
(
typename
PFP
::
MAP
&
map
)
:
m_map
(
map
),
shareVertexEmbeddings
(
false
)
{
}
template
<
typename
PFP
>
Map3MR
<
PFP
>::~
Map3MR
()
{
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
Map3MR
<
PFP
>::
addNewLevel
(
bool
embedNewVertices
)
{
m_map
.
pushLevel
()
;
m_map
.
addLevelBack
()
;
m_map
.
duplicateDarts
(
m_map
.
getMaxLevel
());
m_map
.
setCurrentLevel
(
m_map
.
getMaxLevel
())
;
m_map
.
decCurrentLevel
();
TraversorF
<
typename
PFP
::
MAP
>
tf
(
m_map
);
for
(
Dart
d
=
tf
.
begin
();
d
!=
tf
.
end
();
d
=
tf
.
next
())
{
if
(
!
m_map
.
isBoundaryFace
(
d
))
{
unsigned
int
nbSides
=
m_map
.
faceDegree
(
d
);
Dart
d3
=
m_map
.
phi3
(
d
);
m_map
.
incCurrentLevel
();
m_map
.
unsewVolumes
(
d
,
false
);
Dart
nf
=
Algo
::
Surface
::
Modelisation
::
createPrism
<
PFP
>
(
m_map
,
nbSides
,
false
);
m_map
.
sewVolumes
(
d
,
nf
,
false
);
m_map
.
sewVolumes
(
d3
,
m_map
.
phi2
(
m_map
.
phi1
(
m_map
.
phi1
(
m_map
.
phi2
(
nf
)))),
false
);
m_map
.
decCurrentLevel
();
}
}
TraversorE
<
typename
PFP
::
MAP
>
te
(
m_map
);
for
(
Dart
d
=
te
.
begin
()
;
d
!=
te
.
end
()
;
d
=
te
.
next
())
{
if
(
!
m_map
.
isBoundaryEdge
(
d
))
{
m_map
.
incCurrentLevel
();
m_map
.
PFP
::
MAP
::
TOPO_MAP
::
closeHole
(
m_map
.
phi3
(
d
),
false
);
m_map
.
decCurrentLevel
();
}
}
// TraversorV<typename PFP::MAP> tv(m_map);
// for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
// {
// m_map.incCurrentLevel();
//
// m_map.PFP::MAP::TOPO_MAP::closeHole(m_map.phi2(m_map.phi_1(m_map.phi3(m_map.phi2(d)))),false);
//
// Dart temp = m_map.phi2(m_map.phi1(m_map.phi2(d)));
// Dart stop = temp;
//
// do
// {
// if(!shareVertexEmbeddings)
// {
// //if(m_map.template getEmbedding<VERTEX>(d) == EMBNULL)
// m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(temp) ;
// //m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(d2) ;
// }
//
//
// temp = m_map.phi1(temp);
// }
// while(temp != stop);
//
//
// m_map.decCurrentLevel();
// }
m_map
.
incCurrentLevel
()
;
m_map
.
popLevel
()
;
}
template
<
typename
PFP
>
void
Map3MR
<
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
Map3MR
<
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 Surface
}
// namespace Algo
}
// namespace CGoGN
include/Topology/map/embeddedMap3.h
View file @
b7e8bfa8
...
...
@@ -107,7 +107,7 @@ public:
//!
/*!
*/
virtual
void
unsewVolumes
(
Dart
d
);
virtual
void
unsewVolumes
(
Dart
d
,
bool
withBoundary
=
true
);
//!
/*!
...
...
include/Topology/map/map3.h
View file @
b7e8bfa8
...
...
@@ -262,7 +262,7 @@ public:
//! Unsew two oriented volumes along their faces.
/*! @param d a dart of one volume
*/
virtual
void
unsewVolumes
(
Dart
d
);
virtual
void
unsewVolumes
(
Dart
d
,
bool
withBoundary
=
true
);
//! Merge two volumes along their common oriented face
/*! @param d a dart of common face
...
...
src/Topology/map/embeddedMap3.cpp
View file @
b7e8bfa8
...
...
@@ -357,8 +357,14 @@ void EmbeddedMap3::sewVolumes(Dart d, Dart e, bool withBoundary)
}
}
void
EmbeddedMap3
::
unsewVolumes
(
Dart
d
)
void
EmbeddedMap3
::
unsewVolumes
(
Dart
d
,
bool
withBoundary
)
{
if
(
!
withBoundary
)
{
Map3
::
unsewVolumes
(
d
,
false
)
;
return
;
}
Dart
dd
=
alpha1
(
d
);
unsigned
int
fEmb
=
EMBNULL
;
...
...
src/Topology/map/map3.cpp
View file @
b7e8bfa8
...
...
@@ -706,10 +706,21 @@ bool Map3::unsewVolumesPreCond(Dart d)
}
void
Map3
::
unsewVolumes
(
Dart
d
)
void
Map3
::
unsewVolumes
(
Dart
d
,
bool
withBoundary
)
{
assert
(
unsewVolumesPreCond
(
d
))
;
if
(
!
withBoundary
)
{
Dart
fitD
=
d
;
do
{
phi3unsew
(
fitD
)
;
fitD
=
phi1
(
fitD
)
;
}
while
(
fitD
!=
d
)
;
return
;
}
unsigned
int
nbE
=
faceDegree
(
d
)
;
Dart
d3
=
phi3
(
d
);
...
...
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