Optimized NzNormalizeAngle

Former-commit-id: cbdc09b7dc89c03c178a7b0a22571e810598c6fb
This commit is contained in:
Lynix 2012-12-06 01:05:40 +01:00
parent f72210e728
commit 783c1d5584
1 changed files with 3 additions and 11 deletions

View File

@ -155,19 +155,11 @@ T NzNormalizeAngle(T angle)
const T limit = F(180.0); const T limit = F(180.0);
#endif #endif
///TODO: Trouver une solution sans duplication while (angle > limit)
if (angle > F(0.0))
{
angle += limit;
angle -= static_cast<int>(angle / (F(2.0)*limit)) * (F(2.0)*limit);
angle -= limit; angle -= limit;
}
else while (angle < limit)
{
angle -= limit;
angle -= static_cast<int>(angle / (F(2.0)*limit)) * (F(2.0)*limit);
angle += limit; angle += limit;
}
return angle; return angle;
} }