corrected bug on FollowDirection

This commit is contained in:
Nico Pietroni 2012-12-31 16:20:23 +00:00
parent a3a542edf2
commit e1481b34ac
1 changed files with 16 additions and 2 deletions
vcg/complex/algorithms/parametrization

View File

@ -67,7 +67,21 @@ namespace vcg {
CoordType dirR=vcg::tri::CrossField<MeshType>::Rotate(f0,f1,dirS);
///then get the closest upf to K*PI/2 rotations
CoordType dir1=f1.cPD1();
int ret=I_K_PI(dir1,dirR,f1.cN());
//int ret=I_K_PI(dir1,dirR,f1.cN());
CoordType dir[4];
CrossVector(f1,dir);
ScalarType best=-1;
int ret=-1;
for (int i=0;i<4;i++)
{
ScalarType dot=dir[i]*dirR;
if (dot>best)
{
best=dot;
ret=i;
}
}
assert(ret!=-1);
return ret;
}