From b9f4b1a4cb6a74425bcf925e4cb3fe8ad26769b0 Mon Sep 17 00:00:00 2001 From: nico Date: Mon, 8 Jan 2018 15:59:07 +1100 Subject: [PATCH] added GloballyRotate function to rotate the UV parametrization --- .../algorithms/parametrization/uv_utils.h | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/vcg/complex/algorithms/parametrization/uv_utils.h b/vcg/complex/algorithms/parametrization/uv_utils.h index 53a46f8d..b813fa2d 100644 --- a/vcg/complex/algorithms/parametrization/uv_utils.h +++ b/vcg/complex/algorithms/parametrization/uv_utils.h @@ -24,7 +24,6 @@ #ifndef VCG_UV_UTILS #define VCG_UV_UTILS - namespace vcg { namespace tri{ template @@ -112,6 +111,26 @@ public: } } + static void GloballyRotate(MeshType &m,ScalarType Angle) + { + vcg::Box2 BB=PerWedgeUVBox(m); + UVCoordType Origin=BB.Center(); + typename MeshType::FaceIterator fi; + for (fi=m.face.begin();fi!=m.face.end();fi++) + { + if ((*fi).IsD()) continue; + for (int i=0;i<3;i++) + { + (*fi).WT(i).P()-=Origin; + ScalarType X1=(*fi).WT(i).P().X()*cos(Angle)-(*fi).WT(i).P().Y()*sin(Angle); + ScalarType Y1=(*fi).WT(i).P().X()*cos(Angle)+(*fi).WT(i).P().Y()*sin(Angle); + (*fi).WT(i).P().X()=X1; + (*fi).WT(i).P().Y()=Y1; + (*fi).WT(i).P()+=Origin; + } + } + } + static void LaplacianUVVert(MeshType &m,bool fix_borders=false,int steps=3) { FaceIterator fi;