Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
71e9d333
Commit
71e9d333
authored
Sep 28, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regular primal sqrt(3) refinement
parent
ddb659ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
151 additions
and
94 deletions
+151
-94
include/Algo/Multiresolution/map2MR/filters_Primal.h
include/Algo/Multiresolution/map2MR/filters_Primal.h
+97
-0
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
+32
-19
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.h
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.h
+12
-6
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.hpp
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.hpp
+0
-52
include/Algo/Multiresolution/map2MR/map2MR_PrimalRegular.hpp
include/Algo/Multiresolution/map2MR/map2MR_PrimalRegular.hpp
+10
-17
No files found.
include/Algo/Multiresolution/map2MR/filters_Primal.h
View file @
71e9d333
...
...
@@ -250,7 +250,104 @@ public:
}
}
;
/*********************************************************************************
* SYNTHESIS FILTERS
*********************************************************************************/
/* Linear Interpolation
*********************************************************************************/
template
<
typename
PFP
>
class
LerpEdgeSynthesisFilter
:
public
Filter
{
protected:
typename
PFP
::
MAP
&
m_map
;
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
public:
LerpEdgeSynthesisFilter
(
typename
PFP
::
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
void
operator
()
()
{
TraversorE
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
typename
PFP
::
VEC3
p
=
(
m_position
[
d
]
+
m_position
[
m_map
.
phi1
(
d
)])
*
typename
PFP
::
REAL
(
0.5
);
m_map
.
incCurrentLevel
()
;
Dart
midV
=
m_map
.
phi1
(
d
)
;
m_position
[
midV
]
=
p
;
m_map
.
decCurrentLevel
()
;
}
}
}
;
template
<
typename
PFP
>
class
LerpFaceSynthesisFilter
:
public
Filter
{
protected:
typename
PFP
::
MAP
&
m_map
;
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
public:
LerpFaceSynthesisFilter
(
typename
PFP
::
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
void
operator
()
()
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
typename
PFP
::
VEC3
p
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
m_map
,
d
,
m_position
);
m_map
.
incCurrentLevel
()
;
if
(
m_map
.
faceDegree
(
d
)
!=
3
)
{
Dart
midF
=
m_map
.
phi1
(
m_map
.
phi1
(
d
));
m_position
[
midF
]
=
p
;
}
m_map
.
decCurrentLevel
()
;
}
}
}
;
/* SQRT(3)
*********************************************************************************/
template
<
typename
PFP
>
class
Sqrt3OddSynthesisFilter
:
public
Filter
{
protected:
typename
PFP
::
MAP
&
m_map
;
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
public:
Sqrt3OddSynthesisFilter
(
typename
PFP
::
MAP
&
m
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
void
operator
()
()
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
m_map
);
for
(
Dart
d
=
trav
.
begin
()
;
d
!=
trav
.
end
()
;
d
=
trav
.
next
())
{
typename
PFP
::
VEC3
p
(
0.0
);
p
+=
m_position
[
d
];
p
+=
m_position
[
m_map
.
phi1
(
d
)];
p
+=
m_position
[
m_map
.
phi_1
(
d
)];
p
/=
3.0
;
m_map
.
incCurrentLevel
()
;
Dart
midF
=
m_map
.
phi1
(
d
);
m_position
[
midF
]
=
p
;
m_map
.
decCurrentLevel
()
;
}
}
};
/*********************************************************************************
...
...
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
View file @
71e9d333
...
...
@@ -143,14 +143,13 @@ void Map2MR_PM<PFP>::addNewLevel(unsigned int percentWantedVertices)
unsigned
int
percentWantedPerLevel
=
20
;
unsigned
int
nbWantedPerLevel
=
nbWantedVertices
*
percentWantedPerLevel
/
100
;
//create the new level
m_map
.
addLevelFront
();
m_map
.
setCurrentLevel
(
0
);
m_map
.
printMR
();
std
::
vector
<
Dart
>
edges
;
edges
.
reserve
(
nbWantedPerLevel
);
DartMarkerStore
me
(
m_map
);
//mark edges not to collapse
std
::
cout
<<
" nbWantedPerLevel : "
<<
nbWantedPerLevel
<<
std
::
endl
;
bool
finished
=
false
;
Dart
d
;
while
(
!
finished
)
...
...
@@ -179,27 +178,41 @@ void Map2MR_PM<PFP>::addNewLevel(unsigned int percentWantedVertices)
me
.
markOrbit
<
FACE
>
(
it
);
}
++
nbDeletedVertex
;
Dart
d2
=
m_map
.
phi2
(
m_map
.
phi_1
(
d
))
;
Dart
dd2
=
m_map
.
phi2
(
m_map
.
phi_1
(
m_map
.
phi2
(
d
)))
;
m_selector
->
updateBeforeCollapse
(
d
)
;
// update selector
edges
.
push_back
(
d
);
collapseEdge
(
d
);
m_selector
->
updateAfterCollapse
(
d2
,
dd2
)
;
// update selector
if
(
nbDeletedVertex
<=
nbWantedPerLevel
)
finished
=
true
;
std
::
cout
<<
" nbDeletedVertex : "
<<
nbDeletedVertex
<<
std
::
endl
;
}
}
if
(
nbDeletedVertex
>
nbWantedPerLevel
)
finished
=
true
;
}
CGoGNout
<<
"..done ("
<<
nbDeletedVertex
<<
" vertices)"
<<
CGoGNendl
;
m_map
.
printMR
();
std
::
cout
<<
" finished "
<<
std
::
endl
;
// //create the new level
// m_map.addLevelFront();
// m_map.setCurrentLevel(0);
//
//
//
//
//
// Dart d2 = m_map.phi2(m_map.phi_1(d)) ;
// Dart dd2 = m_map.phi2(m_map.phi_1(m_map.phi2(d))) ;
//
// m_selector->updateBeforeCollapse(d) ; // update selector
//
// collapseEdge(d);
//
// m_selector->updateAfterCollapse(d2, dd2) ; // update selector
//
//
// CGoGNout << "..done (" << nbDeletedVertex << " vertices)" << CGoGNendl ;
//
// m_map.printMR();
}
...
...
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.h
View file @
71e9d333
...
...
@@ -119,14 +119,22 @@ public:
*/
bool
faceIsSubdividedOnce
(
Dart
d
)
;
/***************************************************
* SUBDIVISION *
***************************************************/
protected:
/**
*
*/
Dart
cutEdge
(
Dart
d
)
;
/**
*
*/
void
splitFace
(
Dart
d
,
Dart
e
)
;
protected:
/***************************************************
* SUBDIVISION *
***************************************************/
/**
* subdivide the edge of d to the next level
*/
...
...
@@ -143,8 +151,6 @@ public:
*/
unsigned
int
subdivideFace
(
Dart
d
,
bool
triQuad
=
true
,
bool
OneLevelDifference
=
true
);
unsigned
int
subdivideFace2
(
Dart
d
)
;
/**
* coarsen the face of d from the next level
*/
...
...
include/Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.hpp
View file @
71e9d333
...
...
@@ -419,58 +419,6 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe
return
fLevel
;
}
template
<
typename
PFP
>
unsigned
int
Map2MR
<
PFP
>::
subdivideFace2
(
Dart
d
)
{
assert
(
m_map
.
getDartLevel
(
d
)
<=
m_map
.
getCurrentLevel
()
||
!
"subdivideFace : called with a dart inserted after current level"
)
;
assert
(
!
faceIsSubdivided
(
d
)
||
!
"Trying to subdivide an already subdivided face"
)
;
unsigned
int
fLevel
=
faceLevel
(
d
)
;
Dart
old
=
faceOldestDart
(
d
)
;
std
::
cout
<<
"face level "
<<
fLevel
<<
std
::
endl
;
std
::
cout
<<
"oldestDart "
<<
old
<<
std
::
endl
;
m_map
.
pushLevel
()
;
m_map
.
setCurrentLevel
(
fLevel
)
;
// go to the level of the face to subdivide its edges
if
(
m_map
.
getCurrentLevel
()
==
m_map
.
getMaxLevel
())
{
std
::
cout
<<
"addLevelBack"
<<
std
::
endl
;
m_map
.
addLevelBack
();
}
unsigned
int
degree
=
3
;
Dart
it
=
old
;
if
(
!
edgeIsSubdivided
(
it
))
{
std
::
cout
<<
"1"
<<
std
::
endl
;
subdivideEdge
(
it
)
;
}
it
=
m_map
.
phi1
(
it
)
;
if
(
!
edgeIsSubdivided
(
it
))
{
std
::
cout
<<
"2"
<<
std
::
endl
;
subdivideEdge
(
it
)
;
}
it
=
m_map
.
phi1
(
it
)
;
if
(
!
edgeIsSubdivided
(
it
))
{
std
::
cout
<<
"3"
<<
std
::
endl
;
subdivideEdge
(
it
)
;
}
it
=
m_map
.
phi1
(
it
)
;
std
::
cout
<<
"degree = "
<<
degree
<<
std
::
endl
;
m_map
.
popLevel
()
;
return
fLevel
;
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
coarsenFace
(
Dart
d
)
{
...
...
include/Algo/Multiresolution/map2MR/map2MR_PrimalRegular.hpp
View file @
71e9d333
...
...
@@ -46,7 +46,7 @@ Map2MR<PFP>::Map2MR(typename PFP::MAP& map) :
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
addNewLevel
(
bool
triQuad
=
true
,
bool
embedNewVertices
=
true
)
void
Map2MR
<
PFP
>::
addNewLevel
(
bool
triQuad
,
bool
embedNewVertices
)
{
m_map
.
pushLevel
()
;
...
...
@@ -150,22 +150,19 @@ void Map2MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
m_map
.
duplicateDarts
(
m_map
.
getMaxLevel
());
m_map
.
setCurrentLevel
(
m_map
.
getMaxLevel
())
;
DartMarkerStore
m
(
map
)
;
//split faces
TraversorF
<
typename
PFP
::
MAP
>
t
(
map
)
;
TraversorF
<
typename
PFP
::
MAP
>
t
(
m
_m
ap
)
;
for
(
Dart
dit
=
t
.
begin
();
dit
!=
t
.
end
();
dit
=
t
.
next
())
{
Dart
d1
=
m_map
.
phi1
(
dit
);
splitFace
(
dit
,
d1
)
;
cutEdge
(
m_map
.
phi_1
(
dit
))
;
m_map
.
splitFace
(
dit
,
d1
)
;
m_map
.
cutEdge
(
m_map
.
phi_1
(
dit
))
;
Dart
x
=
m_map
.
phi2
(
m_map
.
phi_1
(
dit
))
;
Dart
dd
=
m
ap
.
template
phi
<
111
>(
x
)
;
Dart
dd
=
m
_map
.
phi1
(
m_map
.
phi1
(
m_map
.
phi1
((
x
))))
;
while
(
dd
!=
x
)
{
Dart
next
=
m_map
.
phi1
(
dd
)
;
splitFace
(
dd
,
m_map
.
phi1
(
x
))
;
m_map
.
splitFace
(
dd
,
m_map
.
phi1
(
x
))
;
dd
=
next
;
}
...
...
@@ -177,21 +174,17 @@ void Map2MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
Dart
fit
=
cd
;
do
{
m
.
markOrbit
<
EDGE
>
(
fit
);
t
.
skip
(
fit
);
fit
=
m
ap
.
phi2
(
map
.
phi_1
(
fit
));
fit
=
m
_map
.
phi2
(
m_
map
.
phi_1
(
fit
));
}
while
(
fit
!=
cd
);
}
//swap edges
TraversorE
<
typename
PFP
::
MAP
>
te
(
map
)
;
TraversorE
<
typename
PFP
::
MAP
>
te
(
m
_m
ap
)
;
for
(
Dart
dit
=
te
.
begin
();
dit
!=
te
.
end
();
dit
=
te
.
next
())
{
if
(
m
.
isMarked
(
dit
))
{
m
.
unmarkOrbit
<
EDGE
>
(
dit
);
}
if
(
m_map
.
getDartLevel
(
dit
)
<
m_map
.
getCurrentLevel
())
m_map
.
flipEdge
(
dit
);
}
m_map
.
popLevel
()
;
...
...
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