From 72aa367dfb2baf0c6161d637bda56e3a102a39bc Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 9 Apr 2010 14:43:41 +0000 Subject: [PATCH] various small changes and refactoring to remove warnings and dubious stuff --- .../filter_isoparametrization.cpp | 4 +- .../iso_parametrization.h | 2 +- .../mesh_operators.h | 15 +++---- .../parametrizator.h | 39 ++++++++----------- .../texcoord_optimization.h | 3 ++ 5 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp index 912486cac..160e9a620 100644 --- a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp +++ b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp @@ -247,7 +247,9 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri int stopCriteria=par.getEnum("stopCriteria"); bool doublestep=par.getBool("DoubleStep"); IsoParametrizator Parametrizator; - + + m->updateDataMask(MeshModel::MM_FACEFACETOPO); + bool isTXTenabled=m->hasDataMask(MeshModel::MM_VERTTEXCOORD); if (!isTXTenabled) m->updateDataMask(MeshModel::MM_VERTTEXCOORD); diff --git a/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h b/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h index 54e0a2a77..b1ce06a65 100644 --- a/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h +++ b/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h @@ -1826,7 +1826,7 @@ public: vcg::tri::Append::Mesh(*param_mesh,*_input_mesh); ///quality copy to index of texture - for (int i=0;ivert.size();i++) + for (size_t i=0;ivert.size();i++) param_mesh->vert[i].T().N()=(int)param_mesh->vert[i].Q(); /*if (AbsMesh()!=NULL) diff --git a/src/meshlabplugins/filter_isoparametrization/mesh_operators.h b/src/meshlabplugins/filter_isoparametrization/mesh_operators.h index 2c04f1e06..de17fafb4 100644 --- a/src/meshlabplugins/filter_isoparametrization/mesh_operators.h +++ b/src/meshlabplugins/filter_isoparametrization/mesh_operators.h @@ -341,8 +341,9 @@ void CopySubMeshLevels(std::vector &faces, father->vertices_bary.push_back(std::pair(son,bary)); } } -///return in result the intersection, while in_v0 and in_v1 return -///faces shareb by each vertex +///return false if the the two vertices has no common faces, +/// it stores in the intersection of the faces in v0 and v1, while in_v0 and in_v1 it returns +///the faces shared by each vertex template inline bool getSharedFace(typename MeshType::VertexType *v0, typename MeshType::VertexType *v1, @@ -362,11 +363,11 @@ inline bool getSharedFace(typename MeshType::VertexType *v0, std::set faces0; - ///faces in v0 + ///put faces in v0 in a for(;!vfi0.End();++vfi0) faces0.insert(vfi0.F()); - ///faces in v1 + intersection between both + ///put faces exclusively in v1 in in and build up the vector containing the intersection between both vertices for(;!vfi1.End();++vfi1) if (faces0.count(vfi1.F())!=0) result.push_back(vfi1.F()); @@ -380,17 +381,13 @@ inline bool getSharedFace(typename MeshType::VertexType *v0, bool border=(result.size()==1); for(;!vfi2.End();++vfi2) { - if (non_shared) - in_v0.push_back(vfi2.F()); - else - { if ((!border)&&((result[0]!=vfi2.F())&&(result[1]!=vfi2.F()))) in_v0.push_back(vfi2.F()); else if ((border)&&((result[0]!=vfi2.F()))) in_v0.push_back(vfi2.F()); - } } + return true; } diff --git a/src/meshlabplugins/filter_isoparametrization/parametrizator.h b/src/meshlabplugins/filter_isoparametrization/parametrizator.h index c2b606f78..4dd67bcd8 100644 --- a/src/meshlabplugins/filter_isoparametrization/parametrizator.h +++ b/src/meshlabplugins/filter_isoparametrization/parametrizator.h @@ -358,22 +358,16 @@ private: bool execute_flip=true, bool test_interpolation=true) { - - for (unsigned int i=0;ivert.size();i++) - mesh->vert[i].ClearFlags(); - for (unsigned int i=0;iface.size();i++) - mesh->face[i].ClearFlags(); - + vcg::tri::UpdateFlags::VertexClearV(*mesh); + vcg::tri::UpdateFlags::FaceClearV(*mesh); + + ///TEST PRECONDITIONS + bool isOK=Preconditions(*mesh); + if (!isOK) return NonPrecondition; + ///INITIALIZATION InitializeStructures(mesh); - ///TEST PRECONDITIONS - bool isOK=Preconditions(base_mesh); - if (!isOK) - return NonPrecondition; - - - ///DECIMATION & PARAMETRIZATION ParaDecimate(targetFaces,interval,execute_flip); @@ -708,21 +702,20 @@ public: vcg::tri::UpdateTopology::FaceFace(mesh); b=vcg::tri::Clean::IsTwoManifoldFace(mesh); - if (!b) - return false; + if (!b) return false; b=vcg::tri::Clean::IsTwoManifoldVertexFF(mesh); - if (!b) - return false; + if (!b) return false; b=vcg::tri::Clean::IsSizeConsistent(mesh); - if (!b) - return false; + if (!b) return false; - for (unsigned int i=0;i::ConnectedComponents(mesh); + if(cc>1) return false; + + int boundaryEdgeNum, internalEdgeNum; + vcg::tri::Clean::CountEdges(mesh,internalEdgeNum,boundaryEdgeNum); + if(boundaryEdgeNum>0) return false; return true; } diff --git a/src/meshlabplugins/filter_isoparametrization/texcoord_optimization.h b/src/meshlabplugins/filter_isoparametrization/texcoord_optimization.h index fb943267d..2d10946a3 100644 --- a/src/meshlabplugins/filter_isoparametrization/texcoord_optimization.h +++ b/src/meshlabplugins/filter_isoparametrization/texcoord_optimization.h @@ -629,6 +629,7 @@ public: }; +#if 0 // Temporarly commented out. It still have to be thoroughly tested... template class WachspressTexCoordOptimization:public TexCoordOptimization{ @@ -719,6 +720,7 @@ public: }; +#endif template class MeanValueTexCoordOptimization:public TexCoordOptimization{ @@ -832,6 +834,7 @@ public: #define vs (f->V(s)->P()) #define vd (f->V(d)->P()) #define vo (f->V(o)->P()) + #define EPSILON 1e-4 for (FaceIterator f=Super::m.face.begin(); f!=Super::m.face.end(); f++){ int s=0,d=1,o=2;