Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenMesh
OpenMesh
Commits
959d80bb
Commit
959d80bb
authored
Aug 07, 2013
by
Jan Möbius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished except unittests
git-svn-id:
http://www.openmesh.org/svnrepo/OpenMesh/trunk@910
fdac6126-5c0c-442c-9429-916003d36597
parent
e30da7ea
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
117 additions
and
113 deletions
+117
-113
src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.cc
src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.cc
+3
-3
src/OpenMesh/Apps/Subdivider/adaptive_subdivider.cc
src/OpenMesh/Apps/Subdivider/adaptive_subdivider.cc
+4
-4
src/OpenMesh/Apps/VDProgMesh/Analyzer/vdpmanalyzer.cc
src/OpenMesh/Apps/VDProgMesh/Analyzer/vdpmanalyzer.cc
+4
-4
src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc
...pps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc
+3
-3
src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc
src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc
+5
-5
src/OpenMesh/Apps/mconvert/mconvert.cc
src/OpenMesh/Apps/mconvert/mconvert.cc
+6
-6
src/OpenMesh/Tools/Decimater/ModAspectRatioT.cc
src/OpenMesh/Tools/Decimater/ModAspectRatioT.cc
+9
-7
src/OpenMesh/Tools/Decimater/ModHausdorffT.cc
src/OpenMesh/Tools/Decimater/ModHausdorffT.cc
+9
-7
src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh
src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh
+3
-3
src/OpenMesh/Tools/Decimater/ModProgMeshT.cc
src/OpenMesh/Tools/Decimater/ModProgMeshT.cc
+7
-7
src/OpenMesh/Tools/Decimater/ModRoundnessT.hh
src/OpenMesh/Tools/Decimater/ModRoundnessT.hh
+4
-4
src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc
src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc
+14
-14
src/OpenMesh/Tools/Smoother/LaplaceSmootherT.cc
src/OpenMesh/Tools/Smoother/LaplaceSmootherT.cc
+4
-4
src/OpenMesh/Tools/Smoother/SmootherT.cc
src/OpenMesh/Tools/Smoother/SmootherT.cc
+23
-23
src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.cc
...penMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.cc
+9
-9
src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc
src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc
+10
-10
No files found.
src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.cc
View file @
959d80bb
...
...
@@ -150,11 +150,11 @@ ProgViewerWidget::open_prog_mesh(const char* _filename)
MyMesh
::
Point
bbMin
,
bbMax
;
bbMin
=
bbMax
=
mesh_
.
point
(
vIt
);
bbMin
=
bbMax
=
mesh_
.
point
(
*
vIt
);
for
(;
vIt
!=
vEnd
;
++
vIt
)
{
bbMin
.
minimize
(
mesh_
.
point
(
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
vIt
));
bbMin
.
minimize
(
mesh_
.
point
(
*
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
*
vIt
));
}
// set center and radius
...
...
src/OpenMesh/Apps/Subdivider/adaptive_subdivider.cc
View file @
959d80bb
...
...
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
for
(
f_it
=
mesh
.
faces_begin
();
f_it
!=
mesh
.
faces_end
();
++
f_it
)
{
if
(
mesh
.
data
(
f_it
).
state
()
<
target1
)
{
if
(
mesh
.
data
(
*
f_it
).
state
()
<
target1
)
{
++
i
;
fh
=
*
f_it
;
timer2
.
start
();
...
...
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
for
(
v_it
=
mesh
.
vertices_begin
();
v_it
!=
mesh
.
vertices_end
();
++
v_it
)
{
if
(
mesh
.
data
(
v_it
).
state
()
<
target2
)
{
if
(
mesh
.
data
(
*
v_it
).
state
()
<
target2
)
{
vh
=
*
v_it
;
timer2
.
cont
();
subdivider
.
refine
(
vh
);
...
...
@@ -420,8 +420,8 @@ int main(int argc, char **argv)
for
(
MyMesh
::
VertexIter
v_it
=
mesh
.
vertices_begin
();
v_it
!=
mesh
.
vertices_end
();
++
v_it
)
{
if
(
mesh
.
data
(
v_it
).
state
()
>
max_level
)
max_level
=
mesh
.
data
(
v_it
).
state
();
if
(
mesh
.
data
(
*
v_it
).
state
()
>
max_level
)
max_level
=
mesh
.
data
(
*
v_it
).
state
();
}
...
...
src/OpenMesh/Apps/VDProgMesh/Analyzer/vdpmanalyzer.cc
View file @
959d80bb
...
...
@@ -430,11 +430,11 @@ open_prog_mesh(const std::string& _filename)
Mesh
::
Point
bbMin
,
bbMax
;
bbMin
=
bbMax
=
mesh_
.
point
(
vIt
);
bbMin
=
bbMax
=
mesh_
.
point
(
*
vIt
);
for
(;
vIt
!=
vEnd
;
++
vIt
)
{
bbMin
.
minimize
(
mesh_
.
point
(
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
vIt
));
bbMin
.
minimize
(
mesh_
.
point
(
*
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
*
vIt
));
}
// info
...
...
@@ -661,7 +661,7 @@ vdpm_analysis()
for
(
h_it
=
mesh_
.
halfedges_begin
();
h_it
!=
mesh_
.
halfedges_end
();
++
h_it
)
{
vh
=
mesh_
.
to_vertex_handle
(
*
h_it
);
mesh_
.
data
(
h_it
).
set_vhierarchy_leaf_node_handle
(
mesh_
.
data
(
vh
).
vhierarchy_node_handle
());
mesh_
.
data
(
*
h_it
).
set_vhierarchy_leaf_node_handle
(
mesh_
.
data
(
vh
).
vhierarchy_node_handle
());
}
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
mesh_
.
vertices_end
();
++
v_it
)
...
...
src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc
View file @
959d80bb
...
...
@@ -539,11 +539,11 @@ open_vd_prog_mesh(const char* _filename)
VDPMMesh
::
Point
bbMin
,
bbMax
;
bbMin
=
bbMax
=
mesh_
.
point
(
vIt
);
bbMin
=
bbMax
=
mesh_
.
point
(
*
vIt
);
for
(;
vIt
!=
vEnd
;
++
vIt
)
{
bbMin
.
minimize
(
mesh_
.
point
(
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
vIt
));
bbMin
.
minimize
(
mesh_
.
point
(
*
vIt
));
bbMax
.
maximize
(
mesh_
.
point
(
*
vIt
));
}
// set center and radius
...
...
src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc
View file @
959d80bb
...
...
@@ -321,14 +321,14 @@ int main(int argc, char **argv)
Mesh
::
FaceIter
f_it
;
for
(
f_it
=
mesh
.
faces_begin
();
f_it
!=
mesh
.
faces_end
();
++
f_it
)
if
(
!
mesh
.
status
(
f_it
).
deleted
()
)
mesh
.
update_normal
(
f_it
);
if
(
!
mesh
.
status
(
*
f_it
).
deleted
()
)
mesh
.
update_normal
(
*
f_it
);
for
(
v_it
=
mesh
.
vertices_begin
();
v_it
!=
mesh
.
vertices_end
();
++
v_it
)
if
(
!
mesh
.
status
(
v_it
).
deleted
()
)
if
(
!
mesh
.
status
(
*
v_it
).
deleted
()
)
{
mesh
.
status
(
v_it
).
set_locked
(
false
);
mesh
.
update_normal
(
v_it
);
mesh
.
status
(
*
v_it
).
set_locked
(
false
);
mesh
.
update_normal
(
*
v_it
);
}
}
...
...
src/OpenMesh/Apps/mconvert/mconvert.cc
View file @
959d80bb
...
...
@@ -293,7 +293,7 @@ int main(int argc, char *argv[] )
timer
.
start
();
MyMesh
::
VertexIter
vit
=
mesh
.
vertices_begin
();
for
(;
vit
!=
mesh
.
vertices_end
();
++
vit
)
cog
+=
mesh
.
point
(
vit
);
cog
+=
mesh
.
point
(
*
vit
);
timer
.
stop
();
nv
=
mesh
.
n_vertices
();
cog
*=
1.0
f
/
mesh
.
n_vertices
();
...
...
@@ -303,7 +303,7 @@ int main(int argc, char *argv[] )
vit
=
mesh
.
vertices_begin
();
timer
.
cont
();
for
(;
vit
!=
mesh
.
vertices_end
();
++
vit
)
mesh
.
set_point
(
vit
,
mesh
.
point
(
vit
)
-
cog
);
mesh
.
set_point
(
*
vit
,
mesh
.
point
(
*
vit
)
-
cog
);
timer
.
stop
();
nv
+=
mesh
.
n_vertices
();
}
...
...
@@ -323,7 +323,7 @@ int main(int argc, char *argv[] )
timer
.
start
();
MyMesh
::
VertexIter
vit
=
mesh
.
vertices_begin
();
for
(;
vit
!=
mesh
.
vertices_end
();
++
vit
)
mesh
.
set_point
(
vit
,
mesh
.
point
(
vit
)
+
tvec
.
first
);
mesh
.
set_point
(
*
vit
,
mesh
.
point
(
*
vit
)
+
tvec
.
first
);
timer
.
stop
();
std
::
cout
<<
" moved "
<<
mesh
.
n_vertices
()
<<
" vertices in "
<<
timer
.
as_string
()
<<
std
::
endl
;
...
...
@@ -342,9 +342,9 @@ int main(int argc, char *argv[] )
MyMesh
::
VertexIter
vit
=
mesh
.
vertices_begin
();
for
(;
vit
!=
mesh
.
vertices_end
();
++
vit
)
{
mesh
.
set_color
(
vit
,
MyMesh
::
Color
(
std
::
min
((
int
)(
r
+
0.5
),
255
),
std
::
min
((
int
)(
g
+
0.5
),
255
),
std
::
max
((
int
)(
b
+
0.5
),
0
)
)
);
mesh
.
set_color
(
*
vit
,
MyMesh
::
Color
(
std
::
min
((
int
)(
r
+
0.5
),
255
),
std
::
min
((
int
)(
g
+
0.5
),
255
),
std
::
max
((
int
)(
b
+
0.5
),
0
)
)
);
r
+=
d
;
g
+=
d2
;
b
-=
d
;
...
...
src/OpenMesh/Tools/Decimater/ModAspectRatioT.cc
View file @
959d80bb
...
...
@@ -97,11 +97,12 @@ void ModAspectRatioT<MeshT>::initialize() {
typename
Mesh
::
FVIter
fv_it
;
for
(
f_it
=
mesh_
.
faces_begin
();
f_it
!=
f_end
;
++
f_it
)
{
typename
Mesh
::
Point
&
p0
=
mesh_
.
point
(
fv_it
=
mesh_
.
fv_iter
(
f_it
));
typename
Mesh
::
Point
&
p1
=
mesh_
.
point
(
++
fv_it
);
typename
Mesh
::
Point
&
p2
=
mesh_
.
point
(
++
fv_it
);
fv_it
=
mesh_
.
fv_iter
(
*
f_it
);
typename
Mesh
::
Point
&
p0
=
mesh_
.
point
(
*
fv_it
);
typename
Mesh
::
Point
&
p1
=
mesh_
.
point
(
*
(
++
fv_it
));
typename
Mesh
::
Point
&
p2
=
mesh_
.
point
(
*
(
++
fv_it
));
mesh_
.
property
(
aspect_
,
f_it
)
=
1.0
/
aspectRatio
(
p0
,
p1
,
p2
);
mesh_
.
property
(
aspect_
,
*
f_it
)
=
1.0
/
aspectRatio
(
p0
,
p1
,
p2
);
}
}
...
...
@@ -115,9 +116,10 @@ void ModAspectRatioT<MeshT>::preprocess_collapse(const CollapseInfo& _ci) {
for
(
typename
Mesh
::
VFIter
vf_it
=
mesh_
.
vf_iter
(
_ci
.
v0
);
vf_it
.
is_valid
();
++
vf_it
)
{
fh
=
*
vf_it
;
if
(
fh
!=
_ci
.
fl
&&
fh
!=
_ci
.
fr
)
{
typename
Mesh
::
Point
&
p0
=
mesh_
.
point
(
fv_it
=
mesh_
.
fv_iter
(
fh
));
typename
Mesh
::
Point
&
p1
=
mesh_
.
point
(
++
fv_it
);
typename
Mesh
::
Point
&
p2
=
mesh_
.
point
(
++
fv_it
);
fv_it
=
mesh_
.
fv_iter
(
fh
);
typename
Mesh
::
Point
&
p0
=
mesh_
.
point
(
*
fv_it
);
typename
Mesh
::
Point
&
p1
=
mesh_
.
point
(
*
(
++
fv_it
));
typename
Mesh
::
Point
&
p2
=
mesh_
.
point
(
*
(
++
fv_it
));
mesh_
.
property
(
aspect_
,
fh
)
=
1.0
/
aspectRatio
(
p0
,
p1
,
p2
);
}
...
...
src/OpenMesh/Tools/Decimater/ModHausdorffT.cc
View file @
959d80bb
...
...
@@ -191,7 +191,7 @@ initialize()
typename
Mesh
::
FIter
f_it
(
mesh_
.
faces_begin
()),
f_end
(
mesh_
.
faces_end
());
for
(;
f_it
!=
f_end
;
++
f_it
)
mesh_
.
property
(
points_
,
f_it
).
clear
();
mesh_
.
property
(
points_
,
*
f_it
).
clear
();
}
...
...
@@ -242,9 +242,10 @@ collapse_priority(const CollapseInfo& _ci)
ok
=
false
;
for
(
fh_it
=
faces
.
begin
();
!
ok
&&
fh_it
!=
fh_end
;
++
fh_it
)
{
const
Point
&
p0
=
mesh_
.
point
(
fv_it
=
mesh_
.
cfv_iter
(
*
fh_it
));
const
Point
&
p1
=
mesh_
.
point
(
++
fv_it
);
const
Point
&
p2
=
mesh_
.
point
(
++
fv_it
);
fv_it
=
mesh_
.
cfv_iter
(
*
fh_it
);
const
Point
&
p0
=
mesh_
.
point
(
*
fv_it
);
const
Point
&
p1
=
mesh_
.
point
(
*
(
++
fv_it
));
const
Point
&
p2
=
mesh_
.
point
(
*
(
++
fv_it
));
if
(
distPointTriangleSquared
(
*
p_it
,
p0
,
p1
,
p2
)
<=
sqr_tolerace
)
ok
=
true
;
...
...
@@ -328,9 +329,10 @@ postprocess_collapse(const CollapseInfo& _ci)
emin
=
FLT_MAX
;
for
(
fh_it
=
faces
.
begin
();
fh_it
!=
fh_end
;
++
fh_it
)
{
const
Point
&
p0
=
mesh_
.
point
(
fv_it
=
mesh_
.
cfv_iter
(
*
fh_it
));
const
Point
&
p1
=
mesh_
.
point
(
++
fv_it
);
const
Point
&
p2
=
mesh_
.
point
(
++
fv_it
);
fv_it
=
mesh_
.
cfv_iter
(
*
fh_it
);
const
Point
&
p0
=
mesh_
.
point
(
*
fv_it
);
const
Point
&
p1
=
mesh_
.
point
(
*
(
++
fv_it
));
const
Point
&
p2
=
mesh_
.
point
(
*
(
++
fv_it
));
e
=
distPointTriangleSquared
(
*
p_it
,
p0
,
p1
,
p2
);
if
(
e
<
emin
)
{
...
...
src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh
View file @
959d80bb
...
...
@@ -137,7 +137,7 @@ public:
f_end
=
mesh_
.
faces_end
();
for
(;
f_it
!=
f_end
;
++
f_it
)
mesh_
.
property
(
normal_cones_
,
f_it
)
=
NormalCone
(
mesh_
.
normal
(
f_it
));
mesh_
.
property
(
normal_cones_
,
*
f_it
)
=
NormalCone
(
mesh_
.
normal
(
*
f_it
));
}
/** \brief Control normals when Decimating
...
...
@@ -208,8 +208,8 @@ public:
// account for changed normals
typename
Mesh
::
VertexFaceIter
vf_it
(
mesh_
,
_ci
.
v1
);
for
(;
vf_it
.
is_valid
();
++
vf_it
)
mesh_
.
property
(
normal_cones_
,
vf_it
).
merge
(
NormalCone
(
mesh_
.
normal
(
vf_it
)));
mesh_
.
property
(
normal_cones_
,
*
vf_it
).
merge
(
NormalCone
(
mesh_
.
normal
(
*
vf_it
)));
// normal cones of deleted triangles
...
...
src/OpenMesh/Tools/Decimater/ModProgMeshT.cc
View file @
959d80bb
...
...
@@ -90,10 +90,10 @@ write( const std::string& _ofname )
v_end
=
Base
::
mesh
().
vertices_end
();
for
(;
v_it
!=
v_end
;
++
v_it
)
if
(
!
Base
::
mesh
().
status
(
v_it
).
deleted
())
if
(
!
Base
::
mesh
().
status
(
*
v_it
).
deleted
())
{
vhandles
[
i
]
=
*
v_it
;
Base
::
mesh
().
property
(
idx_
,
v_it
)
=
i
;
Base
::
mesh
().
property
(
idx_
,
*
v_it
)
=
i
;
++
i
;
}
n_base_vertices
=
i
;
...
...
@@ -115,7 +115,7 @@ write( const std::string& _ofname )
typename
Mesh
::
ConstFaceIter
f_it
=
Base
::
mesh
().
faces_begin
(),
f_end
=
Base
::
mesh
().
faces_end
();
for
(;
f_it
!=
f_end
;
++
f_it
)
if
(
!
Base
::
mesh
().
status
(
f_it
).
deleted
())
if
(
!
Base
::
mesh
().
status
(
*
f_it
).
deleted
())
++
n_base_faces
;
// ---------------------------------------- write progressive mesh
...
...
@@ -149,13 +149,13 @@ write( const std::string& _ofname )
// write base faces
for
(
f_it
=
Base
::
mesh
().
faces_begin
();
f_it
!=
f_end
;
++
f_it
)
{
if
(
!
Base
::
mesh
().
status
(
f_it
).
deleted
())
if
(
!
Base
::
mesh
().
status
(
*
f_it
).
deleted
())
{
typename
Mesh
::
ConstFaceVertexIter
fv_it
(
Base
::
mesh
(),
*
f_it
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
fv_it
)
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
++
fv_it
)
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
++
fv_it
)
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
*
fv_it
)
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
*
(
++
fv_it
)
)
);
IO
::
store
(
out
,
Base
::
mesh
().
property
(
idx_
,
*
(
++
fv_it
)
)
);
}
}
...
...
src/OpenMesh/Tools/Decimater/ModRoundnessT.hh
View file @
959d80bb
...
...
@@ -127,14 +127,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
if
(
min_r_
<
0.0
)
// continues mode
{
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
voh_it
)));
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
*
voh_it
)));
fhC
=
Base
::
mesh
().
face_handle
(
*
voh_it
);
for
(
++
voh_it
;
voh_it
.
is_valid
();
++
voh_it
)
{
B
=
C
;
fhB
=
fhC
;
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
voh_it
)));
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
*
voh_it
)));
fhC
=
Base
::
mesh
().
face_handle
(
*
voh_it
);
if
(
fhB
==
_ci
.
fl
||
fhB
==
_ci
.
fr
)
...
...
@@ -150,14 +150,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
}
else
// binary mode
{
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
voh_it
)));
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
*
voh_it
)));
fhC
=
Base
::
mesh
().
face_handle
(
*
voh_it
);
for
(
++
voh_it
;
voh_it
.
is_valid
()
&&
(
priority
==
Base
::
LEGAL_COLLAPSE
);
++
voh_it
)
{
B
=
C
;
fhB
=
fhC
;
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
voh_it
)));
C
=
vector_cast
<
Vec3f
>
(
Base
::
mesh
().
point
(
Base
::
mesh
().
to_vertex_handle
(
*
voh_it
)));
fhC
=
Base
::
mesh
().
face_handle
(
*
voh_it
);
if
(
fhB
==
_ci
.
fl
||
fhB
==
_ci
.
fr
)
...
...
src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc
View file @
959d80bb
...
...
@@ -104,16 +104,16 @@ compute_new_positions_C0()
for
(
v_it
=
Base
::
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
{
if
(
this
->
is_active
(
v_it
))
if
(
this
->
is_active
(
*
v_it
))
{
// compute umbrella
u
=
zero
;
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
*
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
{
w
=
this
->
weight
(
Base
::
mesh_
.
edge_handle
(
vv_it
.
current_halfedge_handle
()));
u
+=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
*
vv_it
))
*
w
;
}
u
*=
this
->
weight
(
v_it
);
u
*=
this
->
weight
(
*
v_it
);
u
-=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
*
v_it
));
// damping
...
...
@@ -146,43 +146,43 @@ compute_new_positions_C1()
for
(
v_it
=
Base
::
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
{
u
=
zero
;
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
*
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
{
w
=
this
->
weight
(
Base
::
mesh_
.
edge_handle
(
vv_it
.
current_halfedge_handle
()));
u
-=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
*
vv_it
))
*
w
;
}
u
*=
this
->
weight
(
v_it
);
u
+=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
v_it
));
u
*=
this
->
weight
(
*
v_it
);
u
+=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
*
v_it
));
Base
::
mesh_
.
property
(
umbrellas_
,
v_it
)
=
u
;
Base
::
mesh_
.
property
(
umbrellas_
,
*
v_it
)
=
u
;
}
// 2nd pass: compute updates
for
(
v_it
=
Base
::
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
{
if
(
this
->
is_active
(
v_it
))
if
(
this
->
is_active
(
*
v_it
))
{
uu
=
zero
;
diag
=
0.0
;
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
for
(
vv_it
=
Base
::
mesh_
.
cvv_iter
(
*
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
{
w
=
this
->
weight
(
Base
::
mesh_
.
edge_handle
(
vv_it
.
current_halfedge_handle
()));
uu
-=
Base
::
mesh_
.
property
(
umbrellas_
,
*
vv_it
);
diag
+=
(
w
*
this
->
weight
(
*
vv_it
)
+
1.0
)
*
w
;
}
uu
*=
this
->
weight
(
v_it
);
diag
*=
this
->
weight
(
v_it
);
uu
+=
Base
::
mesh_
.
property
(
umbrellas_
,
v_it
);
uu
*=
this
->
weight
(
*
v_it
);
diag
*=
this
->
weight
(
*
v_it
);
uu
+=
Base
::
mesh_
.
property
(
umbrellas_
,
*
v_it
);
if
(
diag
)
uu
*=
1.0
/
diag
;
// damping
uu
*=
0.25
;
// store new position
p
=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
v_it
));
p
=
vector_cast
<
typename
Mesh
::
Normal
>
(
Base
::
mesh_
.
point
(
*
v_it
));
p
-=
uu
;
this
->
set_new_position
(
v_it
,
p
);
this
->
set_new_position
(
*
v_it
,
p
);
}
}
}
...
...
src/OpenMesh/Tools/Smoother/LaplaceSmootherT.cc
View file @
959d80bb
...
...
@@ -140,7 +140,7 @@ compute_weights(LaplaceWeighting _weighting)
// init vertex weights
for
(
v_it
=
Base
::
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
Base
::
mesh_
.
property
(
vertex_weights_
,
v_it
)
=
0.0
;
Base
::
mesh_
.
property
(
vertex_weights_
,
*
v_it
)
=
0.0
;
...
...
@@ -156,9 +156,9 @@ compute_weights(LaplaceWeighting _weighting)
v0
=
Base
::
mesh_
.
to_vertex_handle
(
heh0
);
v1
=
Base
::
mesh_
.
to_vertex_handle
(
heh1
);
Base
::
mesh_
.
property
(
edge_weights_
,
e_it
)
=
1.0
;
Base
::
mesh_
.
property
(
vertex_weights_
,
v0
)
+=
1.0
;
Base
::
mesh_
.
property
(
vertex_weights_
,
v1
)
+=
1.0
;
Base
::
mesh_
.
property
(
edge_weights_
,
*
e_it
)
=
1.0
;
Base
::
mesh_
.
property
(
vertex_weights_
,
v0
)
+=
1.0
;
Base
::
mesh_
.
property
(
vertex_weights_
,
v1
)
+=
1.0
;
}
break
;
...
...
src/OpenMesh/Tools/Smoother/SmootherT.cc
View file @
959d80bb
...
...
@@ -135,8 +135,8 @@ initialize(Component _comp, Continuity _cont)
// store original points & normals
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
{
mesh_
.
property
(
original_positions_
,
v_it
)
=
mesh_
.
point
(
v_it
);
mesh_
.
property
(
original_normals_
,
v_it
)
=
mesh_
.
normal
(
v_it
);
mesh_
.
property
(
original_positions_
,
*
v_it
)
=
mesh_
.
point
(
*
v_it
);
mesh_
.
property
(
original_normals_
,
*
v_it
)
=
mesh_
.
normal
(
*
v_it
);
}
}
...
...
@@ -155,7 +155,7 @@ set_active_vertices()
// is something selected?
bool
nothing_selected
(
true
);
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
if
(
mesh_
.
status
(
v_it
).
selected
())
if
(
mesh_
.
status
(
*
v_it
).
selected
())
{
nothing_selected
=
false
;
break
;
}
...
...
@@ -163,15 +163,15 @@ set_active_vertices()
bool
active
;
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
{
active
=
((
nothing_selected
||
mesh_
.
status
(
v_it
).
selected
())
&&
!
mesh_
.
is_boundary
(
v_it
)
&&
!
mesh_
.
status
(
v_it
).
locked
());
active
=
((
nothing_selected
||
mesh_
.
status
(
*
v_it
).
selected
())
&&
!
mesh_
.
is_boundary
(
*
v_it
)
&&
!
mesh_
.
status
(
*
v_it
).
locked
());
if
(
skip_features_
)
{
active
=
active
&&
!
mesh_
.
status
(
v_it
).
feature
();
active
=
active
&&
!
mesh_
.
status
(
*
v_it
).
feature
();
typename
Mesh
::
VertexOHalfedgeIter
voh_it
(
mesh_
,
v_it
);
typename
Mesh
::
VertexOHalfedgeIter
voh_it
(
mesh_
,
*
v_it
);
for
(
;
voh_it
.
is_valid
()
;
++
voh_it
)
{
// If the edge is a feature edge, skip the current vertex while smoothing
...
...
@@ -190,7 +190,7 @@ set_active_vertices()
}
}
mesh_
.
property
(
is_active_
,
v_it
)
=
active
;
mesh_
.
property
(
is_active_
,
*
v_it
)
=
active
;
}
...
...
@@ -200,7 +200,7 @@ set_active_vertices()
typename
Mesh
::
VVIter
vv_it
;
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
v_end
;
++
v_it
)
if
(
mesh_
.
is_boundary
(
v_it
))
if
(
mesh_
.
is_boundary
(
*
v_it
))
for
(
vv_it
=
mesh_
.
vv_iter
(
*
v_it
);
vv_it
.
is_valid
();
++
vv_it
)
mesh_
.
property
(
is_active_
,
*
vv_it
)
=
false
;
}
...
...
@@ -360,14 +360,14 @@ project_to_tangent_plane()
for
(;
v_it
!=
v_end
;
++
v_it
)
{
if
(
is_active
(
v_it
))
if
(
is_active
(
*
v_it
))
{
translation
=
new_position
(
v_it
)
-
orig_position
(
v_it
);
normal
=
orig_normal
(
v_it
);
translation
=
new_position
(
*
v_it
)
-
orig_position
(
*
v_it
);
normal
=
orig_normal
(
*
v_it
);
normal
*=
dot
(
translation
,
normal
);
translation
-=
normal
;
translation
+=
vector_cast
<
typename
Mesh
::
Normal
>
(
orig_position
(
v_it
));
set_new_position
(
v_it
,
translation
);
translation
+=
vector_cast
<
typename
Mesh
::
Normal
>
(
orig_position
(
*
v_it
));
set_new_position
(
*
v_it
,
translation
);
}
}
}
...
...
@@ -390,17 +390,17 @@ local_error_check()
for
(;
v_it
!=
v_end
;
++
v_it
)
{
if
(
is_active
(
v_it
))
if
(
is_active
(
*
v_it
))
{
translation
=
new_position
(
v_it
)
-
orig_position
(
v_it
);
translation
=
new_position
(
*
v_it
)
-
orig_position
(
*
v_it
);
s
=
fabs
(
dot
(
translation
,
orig_normal
(
v_it
)));
s
=
fabs
(
dot
(
translation
,
orig_normal
(
*
v_it
)));
if
(
s
>
tolerance_
)
{
translation
*=
(
tolerance_
/
s
);
translation
+=
vector_cast
<
NormalType
>
(
orig_position
(
v_it
));
set_new_position
(
v_it
,
translation
);
translation
*=
(
tolerance_
/
s
);
translation
+=
vector_cast
<
NormalType
>
(
orig_position
(
*
v_it
));
set_new_position
(
*
v_it
,
translation
);
}
}
}
...
...
@@ -419,8 +419,8 @@ move_points()
v_end
(
mesh_
.
vertices_end
());
for
(;
v_it
!=
v_end
;
++
v_it
)
if
(
is_active
(
v_it
))
mesh_
.
set_point
(
v_it
,
mesh_
.
property
(
new_positions_
,
v_it
));
if
(
is_active
(
*
v_it
))
mesh_
.
set_point
(
*
v_it
,
mesh_
.
property
(
new_positions_
,
*
v_it
));
}
...
...
src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.cc
View file @
959d80bb
...
...
@@ -83,25 +83,25 @@ initialize( void )
// ---------------------------------------- Init Vertices
for
(
v_it
=
mesh_
.
vertices_begin
();
v_it
!=
mesh_
.
vertices_end
();
++
v_it
)
{
mesh_
.
data
(
v_it
).
set_state
(
0
);
mesh_
.
data
(
v_it
).
set_final
();
mesh_
.
data
(
v_it
).
set_position
(
0
,
mesh_
.
point
(
*
v_it
));
mesh_
.
data
(
*
v_it
).
set_state
(
0
);
mesh_
.
data
(
*
v_it
).
set_final
();
mesh_
.
data
(
*
v_it
).
set_position
(
0
,
mesh_
.
point
(
*
v_it
));
}
// ---------------------------------------- Init Faces
for
(
f_it
=
mesh_
.
faces_begin
();
f_it
!=
mesh_
.
faces_end
();
++
f_it
)
{
mesh_
.
data
(
f_it
).
set_state
(
0
);
mesh_
.
data
(
f_it
).
set_final
();
mesh_
.
data
(
f_it
).
set_position
(
0
,
zero_point
);
mesh_
.
data
(
*
f_it
).
set_state
(
0
);
mesh_
.
data
(
*
f_it
).
set_final
();
mesh_
.
data
(
*
f_it
).
set_position
(
0
,
zero_point
);
}
// ---------------------------------------- Init Edges
for
(
e_it
=
mesh_
.
edges_begin
();
e_it
!=
mesh_
.
edges_end
();
++
e_it
)
{
mesh_
.
data
(
e_it
).
set_state
(
0
);
mesh_
.
data
(
e_it
).
set_final
();
mesh_
.
data
(
e_it
).
set_position
(
0
,
zero_point
);
mesh_
.
data
(
*
e_it
).
set_state
(
0
);
mesh_
.
data
(
*
e_it
).
set_final
();
mesh_
.
data
(
*
e_it
).
set_position
(
0
,
zero_point
);
}
...
...
src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.cc
View file @
959d80bb
...
...
@@ -845,7 +845,7 @@ void VF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
for
(
fv_it
=
Base
::
mesh_
.
fv_iter
(
_fh
);
fv_it
.
is_valid
();
++
fv_it
)
{
++
valence
;
position
+=
Base
::
mesh_
.
data
(
fv_it
).
position
(
_target_state
-
1
);
position
+=
Base
::
mesh_
.
data
(
*
fv_it
).
position
(
_target_state
-
1
);
}
position
/=
valence
;
...
...
@@ -917,7 +917,7 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
++
valence
;
position
+=
Base
::
mesh_
.
data
(
ff_it
).
position
(
_target_state
-
1
);
position
+=
Base
::
mesh_
.
data
(
*
ff_it
).
position
(
_target_state
-
1
);
}
position
/=
valence
;
...
...
@@ -975,7 +975,7 @@ void FFc<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
for
(
ff_it
=
Base
::
mesh_
.
ff_iter
(
_fh
);
ff_it
.
is_valid
();
++
ff_it
)