From b3fa939960e777dc6ca7f0be276d089b8fdaf86f Mon Sep 17 00:00:00 2001 From: Nico Pietroni nicopietroni Date: Thu, 20 May 2010 13:59:35 +0000 Subject: [PATCH] resolved various bugs --- .../filter_isoparametrization.cpp | 2 ++ .../filter_isoparametrization/iso_parametrization.h | 6 +++++- .../filter_isoparametrization/uv_grid.h | 13 ++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp index 72a16ee58..290eb02c4 100644 --- a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp +++ b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp @@ -403,6 +403,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri m->updateDataMask(MeshModel::MM_WEDGTEXCOORD); m->updateDataMask(MeshModel::MM_VERTTEXCOORD); m->updateDataMask(MeshModel::MM_FACECOLOR); + m->updateDataMask(MeshModel::MM_VERTQUALITY); //} if(!QFile(m->fullName()).exists()) { @@ -425,6 +426,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri } case ISOP_SAVE : { + m->updateDataMask(MeshModel::MM_VERTQUALITY); bool b=vcg::tri::Allocator::IsValidHandle(*mesh,isoPHandle); if (!b) { diff --git a/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h b/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h index 6e40e2aee..1ab299f5e 100644 --- a/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h +++ b/src/meshlabplugins/filter_isoparametrization/iso_parametrization.h @@ -450,6 +450,7 @@ private: //CreateMeshVertexStar(starCenter,ordered_faces,*star_meshes[index].domain); ///get faces referenced by vertices getSharedFace(starCenter,ordered_faces); + CopyMeshFromFacesAbs(ordered_faces,ordered_vert,*star_meshes[index].domain); UpdateTopologies(star_meshes[index].domain); @@ -1827,8 +1828,11 @@ public: ///quality copy to index of texture for (size_t i=0;ivert.size();i++) + { + /*int val0=(int)param_mesh->vert[i].Q(); + int val1=param_mesh->vert[i].T().N();*/ param_mesh->vert[i].T().N()=(int)param_mesh->vert[i].Q(); - + } /*if (AbsMesh()!=NULL) delete(AbsMesh());*/ diff --git a/src/meshlabplugins/filter_isoparametrization/uv_grid.h b/src/meshlabplugins/filter_isoparametrization/uv_grid.h index 94490992f..a373d83c8 100644 --- a/src/meshlabplugins/filter_isoparametrization/uv_grid.h +++ b/src/meshlabplugins/filter_isoparametrization/uv_grid.h @@ -170,12 +170,19 @@ public: { ScalarType dist=100.0; + vcg::Point2 UVTest=UV; + ///then project to the bbox if (!bbox2.IsIn(UV)) - return false; + { + UVTest= ClosestPoint2Box2(UV,bbox2); + ///move toward to the center + UVTest=UVTest+(bbox2.Center()-UVTest)*0.0001; + bbox2.IsIn(UVTest); + } //const ScalarType _EPSILON = ScalarType(0.000000001); - vcg::Point2i cell=Cell(UV); + vcg::Point2i cell=Cell(UVTest); ///test for each face for (unsigned int i=0;i t2d=vcg::Triangle2(tex0,tex1,tex2); vcg::Point2 closest; ScalarType dist_test; - t2d.PointDistance(UV,dist_test,closest); + t2d.PointDistance(UVTest,dist_test,closest); if (dist_test