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
f6b54806
Commit
f6b54806
authored
Jul 12, 2011
by
Basile Sauvage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction du filtre de Taubin
parent
21f73349
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
include/Algo/Filtering/functors.h
include/Algo/Filtering/functors.h
+5
-5
include/Algo/Filtering/taubin.h
include/Algo/Filtering/taubin.h
+10
-6
No files found.
include/Algo/Filtering/functors.h
View file @
f6b54806
...
...
@@ -71,14 +71,14 @@ protected:
T
sum
;
unsigned
int
count
;
public:
FunctorAverageOnSphereBorder
(
typename
PFP
::
MAP
&
map
,
const
AttributeHandler
<
T
>&
a
,
const
AttributeHandler
<
VEC3
>&
p
,
VEC3
&
c
=
VEC3
(
0
),
typename
PFP
::
REAL
r
=
0
)
:
FunctorMap
<
typename
PFP
::
MAP
>
(
map
),
attr
(
a
),
position
(
p
),
center
(
c
),
radius
(
r
),
sum
(
0
),
count
(
0
)
{}
FunctorAverageOnSphereBorder
(
typename
PFP
::
MAP
&
map
,
const
AttributeHandler
<
T
>&
a
,
const
AttributeHandler
<
VEC3
>&
p
)
:
FunctorMap
<
typename
PFP
::
MAP
>
(
map
),
attr
(
a
),
position
(
p
),
sum
(
0
),
count
(
0
)
{
center
=
VEC3
(
0
);
radius
=
0
;
}
bool
operator
()(
Dart
d
)
{
typename
PFP
::
REAL
alpha
=
0
;
Algo
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
center
,
radius
,
d
,
position
,
alpha
);
sum
+=
(
1
-
alpha
)
*
attr
[
d
]
+
alpha
*
attr
[
this
->
map
.
phi1
(
d
)]
;
Algo
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
m_
map
,
center
,
radius
,
d
,
position
,
alpha
);
sum
+=
(
1
-
alpha
)
*
attr
[
d
]
+
alpha
*
attr
[
this
->
m_
map
.
phi1
(
d
)]
;
++
count
;
return
false
;
}
...
...
include/Algo/Filtering/taubin.h
View file @
f6b54806
...
...
@@ -94,6 +94,7 @@ void filterTaubin_modified(typename PFP::MAP& map, typename PFP::TVEC3& position
const
float
lambda
=
0.6307
;
const
float
mu
=
-
0.6732
;
FunctorAverageOnSphereBorder
<
PFP
,
typename
PFP
::
VEC3
>
fa1
(
map
,
position
,
position
)
;
Algo
::
Selection
::
Collector_WithinSphere
<
PFP
>
c1
(
map
,
position
,
radius
)
;
CellMarkerNoUnmark
mv
(
map
,
VERTEX
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
...
...
@@ -103,16 +104,19 @@ void filterTaubin_modified(typename PFP::MAP& map, typename PFP::TVEC3& position
mv
.
mark
(
d
);
c1
.
collectBorder
(
d
)
;
VEC3
center
=
position
[
d
]
;
FunctorAverageOnSphereBorder
<
PFP
,
typename
PFP
::
VEC3
>
fa
(
map
,
position
,
position
,
center
,
radius
)
;
c1
.
applyOnBorder
(
fa
)
;
VEC3
displ
=
fa
.
getAverage
()
-
center
;
fa1
.
reset
(
center
,
radius
)
;
c1
.
applyOnBorder
(
fa1
)
;
VEC3
displ
=
fa1
.
getAverage
()
-
center
;
displ
*=
lambda
;
position2
[
d
]
=
center
+
displ
;
}
}
// unshrinking step
FunctorAverageOnSphereBorder
<
PFP
,
typename
PFP
::
VEC3
>
fa2
(
map
,
position2
,
position2
)
;
Algo
::
Selection
::
Collector_WithinSphere
<
PFP
>
c2
(
map
,
position2
,
radius
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
...
...
@@ -122,9 +126,9 @@ void filterTaubin_modified(typename PFP::MAP& map, typename PFP::TVEC3& position
c2
.
collectBorder
(
d
)
;
VEC3
center
=
position2
[
d
]
;
FunctorAverageOnSphereBorder
<
PFP
,
typename
PFP
::
VEC3
>
fa
(
map
,
position2
,
position2
,
center
,
radius
)
;
c2
.
applyOnBorder
(
fa
)
;
VEC3
displ
=
fa
.
getAverage
()
-
center
;
fa2
.
reset
(
center
,
radius
)
;
c2
.
applyOnBorder
(
fa
2
)
;
VEC3
displ
=
fa
2
.
getAverage
()
-
center
;
displ
*=
mu
;
position
[
d
]
=
center
+
displ
;
}
...
...
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