added GloballyRotate function to rotate the UV parametrization

This commit is contained in:
nico 2018-01-08 15:59:07 +11:00
parent 8b9f2ee2bd
commit b9f4b1a4cb
1 changed files with 20 additions and 1 deletions

View File

@ -24,7 +24,6 @@
#ifndef VCG_UV_UTILS
#define VCG_UV_UTILS
namespace vcg {
namespace tri{
template <class MeshType>
@ -112,6 +111,26 @@ public:
}
}
static void GloballyRotate(MeshType &m,ScalarType Angle)
{
vcg::Box2<ScalarType> 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;