Optimized NzNormalizeAngle
Former-commit-id: cbdc09b7dc89c03c178a7b0a22571e810598c6fb
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user