From 7c78d81cdc2104948b605f33edcc30ea15014e8d Mon Sep 17 00:00:00 2001 From: mtarini Date: Wed, 14 Oct 2009 14:32:55 +0000 Subject: [PATCH] added importance weighting. --- vcg/complex/trimesh/bitquad_optimization.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vcg/complex/trimesh/bitquad_optimization.h b/vcg/complex/trimesh/bitquad_optimization.h index c833620a..f8afd671 100644 --- a/vcg/complex/trimesh/bitquad_optimization.h +++ b/vcg/complex/trimesh/bitquad_optimization.h @@ -84,6 +84,10 @@ static bool MarkSmallestEdge(MeshType &m, bool perform) return false; } +static ScalarType Importance(const CoordType &p){ + return ::proceduralImportance(p); +} + // returns: 0 if fail. 1 if edge. 2 if diag. static int MarkSmallestEdgeOrDiag(MeshType &m, ScalarType edgeMult, bool perform, Pos* affected=NULL) { @@ -100,8 +104,14 @@ static int MarkSmallestEdgeOrDiag(MeshType &m, ScalarType edgeMult, bool perform score = (f->P0(k) - f->P1(k)).Norm(); + ScalarType imp = Importance( (f->P0(k) + f->P1(k))/2 ); + + score /= imp; + if (!f->IsF(k)) score*=edgeMult; // edges are supposed to be smaller! + + if (scoreIsF(k)) { // for diag faces, test counterdiag too score = BQ::CounterDiag(f).Norm(); + score /= imp; + if (score::max();