added GloballyRotate function to rotate the UV parametrization
This commit is contained in:
parent
8b9f2ee2bd
commit
b9f4b1a4cb
|
|
@ -24,7 +24,6 @@
|
||||||
#ifndef VCG_UV_UTILS
|
#ifndef VCG_UV_UTILS
|
||||||
#define VCG_UV_UTILS
|
#define VCG_UV_UTILS
|
||||||
|
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri{
|
namespace tri{
|
||||||
template <class MeshType>
|
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)
|
static void LaplacianUVVert(MeshType &m,bool fix_borders=false,int steps=3)
|
||||||
{
|
{
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue