From ecd1de4d94ad40b0d0de209af23bfe8e625acd3c Mon Sep 17 00:00:00 2001 From: mtarini Date: Fri, 21 Aug 2009 18:46:51 +0000 Subject: [PATCH] added UpdateQualityAsBitQuadValency --- vcg/complex/trimesh/bitquad_support.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vcg/complex/trimesh/bitquad_support.h b/vcg/complex/trimesh/bitquad_support.h index 9da185e2..2f112df4 100644 --- a/vcg/complex/trimesh/bitquad_support.h +++ b/vcg/complex/trimesh/bitquad_support.h @@ -330,7 +330,7 @@ bool RotateBitQuadVertex(FaceType &f, int w0) int tmp = (pf->FFi(pi)+1)%3; pf = pf->FFp(pi); pi = tmp; // flipF if (mustFlip) { - if (!CheckFlipBitQuadDiag(*lastF)) assert(0); //return false; // cannot flip?? + if (!CheckFlipBitQuadDiag(*lastF)) return false; // cannot flip?? FlipBitQuadDiag(*lastF); } @@ -725,4 +725,18 @@ typename Face::ScalarType PosOnDiag(const Face& f, bool counterDiag){ return 0.5f; } +template +void UpdateQualityAsBitQuadValency(Mesh& m){ + typedef typename Mesh::FaceIterator FaceIterator; + typedef typename Mesh::VertexIterator VertexIterator; + for (VertexIterator vi = m.vert.begin(); vi!=m.vert.end(); vi++) if (!vi->IsD()) { + vi->Q() = 0; + } + + for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) { + for (int w=0; w<3; w++) + fi->V(w)->Q() += (fi->IsF(w)||fi->IsF((w+2)%3) )? 0.5f:1; + } +} + }} // end namespace vcg::tri