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
Etienne Schmitt
CGoGN
Commits
1d99adf6
Commit
1d99adf6
authored
Feb 15, 2013
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
somes changes in volumetric sqrt(3) subdivision
parent
a4379092
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
136 deletions
+114
-136
CMakeLists.txt
CMakeLists.txt
+3
-0
apps_cmake.txt
apps_cmake.txt
+3
-0
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+88
-120
include/Algo/Multiresolution/Map2MR/Filters/sqrt3.h
include/Algo/Multiresolution/Map2MR/Filters/sqrt3.h
+20
-16
No files found.
CMakeLists.txt
View file @
1d99adf6
...
...
@@ -33,6 +33,7 @@ find_package(Boost COMPONENTS regex thread system REQUIRED)
find_package
(
ZLIB REQUIRED
)
find_package
(
LibXml2 REQUIRED
)
find_package
(
GLEW REQUIRED
)
find_package
(
SuiteSparse REQUIRED
)
IF
(
DEFINED ASSERTON
)
add_definitions
(
-DCGOGN_ASSERT_BOOL=
${
ASSERTON
}
)
...
...
@@ -77,6 +78,7 @@ SET (CGoGN_EXT_INCLUDES
# define libs for external libs
SET
(
CGoGN_EXT_LIBS
nl
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
...
...
@@ -84,6 +86,7 @@ SET (CGoGN_EXT_LIBS
${
Boost_SYSTEM_LIBRARY
}
${
Boost_REGEX_LIBRARY
}
${
Boost_THREAD_LIBRARY
}
${
SUITESPARSE_LIBRARIES
}
)
#optionnal libs
...
...
apps_cmake.txt
View file @
1d99adf6
...
...
@@ -32,6 +32,7 @@ find_package(Boost COMPONENTS regex thread system REQUIRED)
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(GLEW REQUIRED)
find_package(SuiteSparse REQUIRED)
IF (DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
...
...
@@ -53,6 +54,7 @@ SET(COMMON_INCLUDES
# define libs for external libs
SET (COMMON_LIBS
nl
${OPENGL_LIBRARY}
${GLEW_LIBRARIES}
${ZLIB_LIBRARIES}
...
...
@@ -60,6 +62,7 @@ SET (COMMON_LIBS
${Boost_SYSTEM_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
${SUITESPARSE_LIBRARIES}
)
#optionnal libs
...
...
include/Algo/Modelisation/subdivision3.hpp
View file @
1d99adf6
...
...
@@ -672,7 +672,7 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
Traversor3WF
<
typename
PFP
::
MAP
>
tWF
(
map
,
dit
);
for
(
Dart
ditWF
=
tWF
.
begin
()
;
ditWF
!=
tWF
.
end
()
;
ditWF
=
tWF
.
next
())
{
if
(
!
map
.
isBoundaryFace
(
ditWF
))
if
(
!
map
.
isBoundaryFace
(
ditWF
)
&&
!
m
.
isMarked
(
ditWF
)
)
m
.
markOrbit
<
FACE
>
(
ditWF
);
}
...
...
@@ -711,7 +711,7 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
Traversor3WE
<
typename
PFP
::
MAP
>
tWE
(
map
,
dit
);
for
(
Dart
ditWE
=
tWE
.
begin
()
;
ditWE
!=
tWE
.
end
()
;
ditWE
=
tWE
.
next
())
{
if
(
map
.
isBoundaryEdge
(
ditWE
))
if
(
map
.
isBoundaryEdge
(
ditWE
)
&&
!
m
.
isMarked
(
ditWE
)
)
m
.
markOrbit
<
EDGE
>
(
ditWE
);
}
...
...
@@ -728,45 +728,73 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
}
}
//
// edge-removal on all old boundary edges
//
TraversorE
<
typename
PFP
::
MAP
>
tE
(
map
,
selected
);
for
(
Dart
dit
=
tE
.
begin
()
;
dit
!=
tE
.
end
()
;
dit
=
tE
.
next
())
{
if
(
m
.
isMarked
(
dit
))
{
m
.
unmarkOrbit
<
EDGE
>
(
dit
);
Dart
d
=
map
.
phi2
(
map
.
phi3
(
map
.
findBoundaryFaceOfEdge
(
dit
)));
Volume
::
Modelisation
::
Tetrahedralization
::
swapGen3To2
<
PFP
>
(
map
,
d
);
}
}
TraversorV
<
typename
PFP
::
MAP
>
tVg
(
map
,
selected
);
for
(
Dart
dit
=
tVg
.
begin
()
;
dit
!=
tVg
.
end
()
;
dit
=
tVg
.
next
())
{
if
(
map
.
isBoundaryVertex
(
dit
)
&&
!
newBoundaryV
.
isMarked
(
dit
))
{
typename
PFP
::
VEC3
P
=
position
[
dit
]
;
Dart
db
=
map
.
findBoundaryFaceOfVertex
(
dit
);
typename
PFP
::
VEC3
P
=
position
[
db
]
;
typename
PFP
::
VEC3
newP
(
0
)
;
unsigned
int
val
=
0
;
Dart
vit
=
d
it
;
Dart
vit
=
d
b
;
do
{
newP
+=
position
[
map
.
phi_1
(
map
.
phi2
(
map
.
phi1
(
vit
)))]
;
++
val
;
vit
=
map
.
phi2
(
map
.
phi_1
(
vit
))
;
}
while
(
vit
!=
d
it
)
;
}
while
(
vit
!=
d
b
)
;
typename
PFP
::
REAL
K
=
sqrt3_K
(
val
)
;
newP
*=
typename
PFP
::
REAL
(
3
)
;
newP
-=
typename
PFP
::
REAL
(
val
)
*
P
;
newP
*=
K
/
typename
PFP
::
REAL
(
2
*
val
)
;
newP
+=
(
typename
PFP
::
REAL
(
1
)
-
K
)
*
P
;
position
[
dit
]
=
newP
;
position
[
db
]
=
newP
;
}
}
//
// edge-removal on all old boundary edges
//
TraversorE
<
typename
PFP
::
MAP
>
tE
(
map
,
selected
);
for
(
Dart
dit
=
tE
.
begin
()
;
dit
!=
tE
.
end
()
;
dit
=
tE
.
next
())
{
if
(
m
.
isMarked
(
dit
))
{
m
.
unmarkOrbit
<
EDGE
>
(
dit
);
Dart
d
=
map
.
phi2
(
map
.
phi3
(
map
.
findBoundaryFaceOfEdge
(
dit
)));
Volume
::
Modelisation
::
Tetrahedralization
::
swapGen3To2
<
PFP
>
(
map
,
d
);
}
}
// TraversorV<typename PFP::MAP> tVg(map,selected);
// for(Dart dit = tVg.begin() ; dit != tVg.end() ; dit = tVg.next())
// {
// if(map.isBoundaryVertex(dit) && !newBoundaryV.isMarked(dit))
// {
// Dart db = map.findBoundaryFaceOfVertex(dit);
//
// typename PFP::VEC3 P = position[db] ;
// typename PFP::VEC3 newP(0) ;
// unsigned int val = 0 ;
// Dart vit = db ;
// do
// {
// newP += position[map.phi_1(map.phi2(map.phi1(vit)))] ;
// ++val ;
// vit = map.phi2(map.phi_1(vit)) ;
// } while(vit != db) ;
// typename PFP::REAL K = sqrt3_K(val) ;
// newP *= typename PFP::REAL(3) ;
// newP -= typename PFP::REAL(val) * P ;
// newP *= K / typename PFP::REAL(2 * val) ;
// newP += (typename PFP::REAL(1) - K) * P ;
// position[db] = newP ;
// }
// }
//AutoVertexAttribute laplacian qui est une copie de position
// TraversorV<typename PFP::MAP> tVg2(map,selected);
...
...
@@ -781,108 +809,48 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
//echange lapaclian et position
VertexAutoAttribute
<
typename
PFP
::
VEC3
>
diffCoord
(
map
,
"diffCoord"
);
Algo
::
Volume
::
Geometry
::
computeLaplacianTopoVertices
<
PFP
>
(
map
,
position
,
diffCoord
)
;
VertexAutoAttribute
<
unsigned
int
>
vIndex
(
map
,
"vIndex"
);
unsigned
int
nb_vertices
=
map
.
template
computeIndexCells
<
VERTEX
>(
vIndex
);
CellMarker
<
VERTEX
>
lockingMarker
(
map
);
TraversorV
<
typename
PFP
::
MAP
>
tv
(
map
);
for
(
Dart
dit
=
tv
.
begin
()
;
dit
!=
tv
.
end
()
;
dit
=
tv
.
next
())
{
if
(
!
lockingMarker
.
isMarked
(
dit
)
&&
map
.
isBoundaryVertex
(
dit
))
lockingMarker
.
mark
(
dit
);
}
NLContext
nlContext
=
nlNewContext
();
nlSolverParameteri
(
NL_NB_VARIABLES
,
nb_vertices
);
nlSolverParameteri
(
NL_LEAST_SQUARES
,
NL_TRUE
);
nlSolverParameteri
(
NL_SOLVER
,
NL_CHOLMOD_EXT
);
nlMakeCurrent
(
nlContext
);
if
(
nlGetCurrentState
()
==
NL_STATE_INITIAL
)
nlBegin
(
NL_SYSTEM
)
;
for
(
int
coord
=
0
;
coord
<
3
;
++
coord
)
{
LinearSolving
::
setupVariables
<
PFP
>
(
map
,
vIndex
,
lockingMarker
,
position
,
coord
)
;
nlBegin
(
NL_MATRIX
)
;
LinearSolving
::
addRowsRHS_Laplacian_Topo
<
PFP
>
(
map
,
vIndex
,
diffCoord
,
coord
)
;
// LinearSolving::addRowsRHS_Laplacian_Cotan<PFP>(*map, perMap->vIndex, perMap->edgeWeight, perMap->vertexArea, perMap->diffCoord, coord) ;
nlEnd
(
NL_MATRIX
)
;
nlEnd
(
NL_SYSTEM
)
;
nlSolve
()
;
LinearSolving
::
getResult
<
PFP
>
(
map
,
vIndex
,
position
,
coord
)
;
nlReset
(
NL_TRUE
)
;
}
nlDeleteContext
(
nlContext
);
// VertexAutoAttribute<typename PFP::VEC3> diffCoord(map, "diffCoord");
// Algo::Volume::Geometry::computeLaplacianTopoVertices<PFP>(map, position, diffCoord) ;
//
// float weight = 1.0;
// LinearSolving::LinearSolver<PFP::REAL> ls(nbV);
// ls.set_least_squares(true);
// for(unsigned int coord = 0 ; coord < 3 ; ++coord)
// VertexAutoAttribute<unsigned int> vIndex(map, "vIndex");
//
// unsigned int nb_vertices = map.template computeIndexCells<VERTEX>(vIndex);
//
//
// CellMarker<VERTEX> lockingMarker(map);
//
// TraversorV<typename PFP::MAP> tv(map);
// for(Dart dit = tv.begin() ; dit != tv.end() ; dit = tv.next())
// {
// std::cout << "coord " << coord << std::flush;
// TraversorV<PFP::MAP> tv(map);
// for(Dart dit = tv.begin() ; dit != tv.end() ; dit = tv.next())
// {
// ls.variable(indexV[dit]).set_value(position[dit][coord]);
// if(map.isBoundaryVertex(dit))
// ls.variable(indexV[dit]).lock();
// }
// std::cout << "... variables set... " << std::flush;
// ls.begin_system();
// TraversorV<PFP::MAP> tv2(map);
// for(Dart dit = tv2.begin() ; dit != tv2.end() ; dit = tv2.next())
// {
// if(!map.isBoundaryVertex(dit))
// {
// ls.begin_row();
// float sum = 0;
// Traversor3VVaE<PFP::MAP> tvvae(map, dit);
// for(Dart ditvvae = tvvae.begin() ; ditvvae != tvvae.end() ; ditvvae = tvvae.next())
// {
// ls.add_coefficient(indexV[ditvvae],weight);
// sum += weight;
// }
// ls.add_coefficient(indexV[dit],-sum);
// ls.normalize_row();
// ls.end_row();
// }
// }
// ls.end_system();
// std::cout << "... system built... " << std::flush;
// ls.solve();
// std::cout << "... system solved... " << std::flush;
// TraversorV<PFP::MAP> tv3(map);
// for(Dart dit = tv3.begin() ; dit != tv3.end() ; dit = tv3.next())
// {
// position[dit][coord] = ls.variable(indexV[dit]).value();
// }
// ls.reset(false);
// std::cout << "... done" << std::endl;
// if(map.isBoundaryVertex(dit))
// lockingMarker.mark(dit);
// }
//
//
// NLContext nlContext = nlNewContext();
// nlSolverParameteri(NL_NB_VARIABLES, nb_vertices);
// nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
// nlSolverParameteri(NL_SOLVER, NL_CHOLMOD_EXT);
//
//
// nlMakeCurrent(nlContext);
// if(nlGetCurrentState() == NL_STATE_INITIAL)
// nlBegin(NL_SYSTEM) ;
//
// for(int coord = 0; coord < 3; ++coord)
// {
// LinearSolving::setupVariables<PFP>(map, vIndex, lockingMarker, position, coord) ;
// nlBegin(NL_MATRIX) ;
// LinearSolving::addRowsRHS_Laplacian_Topo<PFP>(map, vIndex, diffCoord, coord) ;
//// LinearSolving::addRowsRHS_Laplacian_Cotan<PFP>(*map, perMap->vIndex, perMap->edgeWeight, perMap->vertexArea, perMap->diffCoord, coord) ;
// nlEnd(NL_MATRIX) ;
// nlEnd(NL_SYSTEM) ;
// nlSolve() ;
// LinearSolving::getResult<PFP>(map, vIndex, position, coord) ;
// nlReset(NL_TRUE) ;
// }
//
// nlDeleteContext(nlContext);
}
template
<
typename
PFP
>
...
...
include/Algo/Multiresolution/Map2MR/Filters/sqrt3.h
View file @
1d99adf6
...
...
@@ -114,6 +114,11 @@ public:
{}
void
operator
()
()
{
}
void
operator
()
(
bool
filtering
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
@@ -145,10 +150,6 @@ public:
}
}
void
operator
()
(
bool
filtering
)
{
}
}
;
template
<
typename
PFP
>
...
...
@@ -163,6 +164,11 @@ public:
{}
void
operator
()
()
{
}
void
operator
()
(
bool
filtering
)
{
TraversorV
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
@@ -234,10 +240,6 @@ public:
}
}
void
operator
()
(
bool
filtering
)
{
}
}
;
template
<
typename
PFP
>
...
...
@@ -252,6 +254,11 @@ public:
{}
void
operator
()
()
{
}
void
operator
()
(
bool
filtering
)
{
TraversorV
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
@@ -289,10 +296,6 @@ public:
}
}
void
operator
()
(
bool
filtering
)
{
}
}
;
template
<
typename
PFP
>
...
...
@@ -307,6 +310,11 @@ public:
{}
void
operator
()
()
{
}
void
operator
()
(
bool
filtering
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
@@ -331,10 +339,6 @@ public:
}
}
void
operator
()
(
bool
filtering
)
{
}
}
;
/*********************************************************************************
...
...
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