From fb1f93fcaf370c683b623556f6715022f6eafa4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 10 Apr 2014 08:58:09 +0000 Subject: [PATCH] Fix cppcheck warning in Remesher git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18458 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Algorithms/DiffGeoT.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Algorithms/DiffGeoT.cc b/Algorithms/DiffGeoT.cc index e8a5ff1..d8d8ca5 100755 --- a/Algorithms/DiffGeoT.cc +++ b/Algorithms/DiffGeoT.cc @@ -119,31 +119,29 @@ compute_edge_weights() typename Mesh::EdgeIter e_it, e_end(mesh_.edges_end()); - typename Mesh::HalfedgeHandle heh0, heh1, heh2; - const typename Mesh::Point *p2; - typename Mesh::Point d0, d1; + typename Mesh::HalfedgeHandle heh2; typename Mesh::Scalar weight; for (e_it=mesh_.edges_begin(); e_it!=e_end; ++e_it) { - heh0 = mesh_.halfedge_handle(*e_it, 0); - const typename Mesh::Point& p0 = mesh_.point(mesh_.to_vertex_handle(heh0)); + const typename Mesh::HalfedgeHandle heh0 = mesh_.halfedge_handle(*e_it, 0); + const typename Mesh::Point& p0 = mesh_.point(mesh_.to_vertex_handle(heh0)); - heh1 = mesh_.halfedge_handle(*e_it, 1); - const typename Mesh::Point& p1 = mesh_.point(mesh_.to_vertex_handle(heh1)); + const typename Mesh::HalfedgeHandle heh1 = mesh_.halfedge_handle(*e_it, 1); + const typename Mesh::Point& p1 = mesh_.point(mesh_.to_vertex_handle(heh1)); heh2 = mesh_.next_halfedge_handle(heh0); - p2 = &mesh_.point(mesh_.to_vertex_handle(heh2)); - d0 = (p0 - *p2).normalize(); - d1 = (p1 - *p2).normalize(); + const typename Mesh::Point& p2 = mesh_.point(mesh_.to_vertex_handle(heh2)); + const typename Mesh::Point d0 = (p0 - p2).normalize(); + const typename Mesh::Point d1 = (p1 - p2).normalize(); weight = 1.0 / tan(acos(d0|d1)); heh2 = mesh_.next_halfedge_handle(heh1); - p2 = &mesh_.point(mesh_.to_vertex_handle(heh2)); - d0 = (p0 - *p2).normalize(); - d1 = (p1 - *p2).normalize(); - weight += 1.0 / tan(acos(d0|d1)); + const typename Mesh::Point& p3 = mesh_.point(mesh_.to_vertex_handle(heh2)); + const typename Mesh::Point d2 = (p0 - p3).normalize(); + const typename Mesh::Point d3 = (p1 - p3).normalize(); + weight += 1.0 / tan(acos(d2|d3)); mesh_.property(edge_weight_, *e_it) = weight; } -- GitLab