From cdd0a520a981ed8f5662626ba98ecb47659b6452 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Thu, 14 Oct 2021 23:02:13 +0200 Subject: [PATCH] Update curvature_fitting.h updated curvature local, added callback --- .../algorithms/update/curvature_fitting.h | 42 +++---------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/vcg/complex/algorithms/update/curvature_fitting.h b/vcg/complex/algorithms/update/curvature_fitting.h index 44cd60e0..9de9fe3e 100644 --- a/vcg/complex/algorithms/update/curvature_fitting.h +++ b/vcg/complex/algorithms/update/curvature_fitting.h @@ -619,9 +619,8 @@ class Quadric - static void updateCurvatureLocal (MeshType & mesh, float radiusSphere) + static void updateCurvatureLocal (MeshType & mesh, float radiusSphere, vcg::CallBackPos * cb = NULL) { - bool verbose = false; bool projectionPlaneCheck = true; int vertexesPerFit = 0; @@ -631,24 +630,16 @@ class Quadric { std::vector vv; std::vector vvtmp; - + if (cb && ((i%1024)==00)) { + (*cb)(int(100.0f * (float)i / (float)mesh.vn),"Vertices Analysis"); + } int count; - if (verbose && !((count = (vi - mesh.vert.begin())) % 1000)) - printf ("vertex %d of %d\n",count,mesh.vert.size()); - - // if (kRing != 0) - // expandRing (&*vi, kRing, 5, &vv); - // else expandSphereLocal (mesh, &*vi, radiusSphere, 5, &vv); assert (vv.size() >= 5); CoordType ppn; - // if (averageNormalMode) - // //ppn = (*vi).N(); getAverageNormal (&*vi, vv, &ppn); - // else - // getProjPlaneNormal (&*vi, vv, &ppn); if (projectionPlaneCheck) { @@ -659,33 +650,12 @@ class Quadric } vvtmp.clear(); - - // if (montecarloMaxVertexNum) - // { - // //printf ("P: %d\n", vv.size()); - // vvtmp.reserve (vv.size ()); - // //printf ("TP: %d\n", vvtmp.size()); - // applyMontecarlo (montecarloMaxVertexNum, vv, &vvtmp); - // //printf ("TD: %d\n", vvtmp.size()); - // vv = vvtmp; - // //printf ("D: %d\n", vv.size()); - // //printf ("\n"); - // } - assert (vv.size() >= 5); std::vector ref; computeReferenceFramesLocal (&*vi, ppn, &ref); - /* - printf ("%lf %lf %lf - %lf %lf %lf - %lf %lf %lf\n", - ref[0][0], ref[0][1], ref[0][2], - ref[1][0], ref[1][1], ref[1][2], - ref[2][0], ref[2][1], ref[2][2]); - */ - vertexesPerFit += vv.size(); - //printf ("size: %d\n", vv.size()); QuadricLocal q; fitQuadricLocal (&*vi, ref, vv, &q); @@ -694,9 +664,7 @@ class Quadric } - //if (verbose) - //printf ("average vertex num in each fit: %f, total %d, vn %d\n", ((float) vertexesPerFit) / mesh.vn, vertexesPerFit, mesh.vn); - if (verbose) + if (cb) printf ("average vertex num in each fit: %f\n", ((float) vertexesPerFit) / mesh.vn); }