Merge pull request #1038 from EZForever/patch-angle

fix: glm::angle() discards the sign of result for angles in range (2*pi-1, 2*pi) #1038
This commit is contained in:
Christophe
2020-11-21 22:06:08 +01:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -7,7 +7,10 @@ namespace glm
{
if (abs(x.w) > cos_one_over_two<T>())
{
return asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast<T>(2);
T const a = asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast<T>(2);
if(x.w < static_cast<T>(0))
return pi<T>() * static_cast<T>(2) - a;
return a;
}
return acos(x.w) * static_cast<T>(2);