Fix NaN handling when calculating angle for mat4

The arccos was incorrectly calculated when cosangle was larger than 1.0
This commit is contained in:
Josip Miskovic 2022-02-16 22:52:07 +01:00 committed by Bjorn
parent a6a86fd908
commit 517b104c1e
1 changed files with 1 additions and 1 deletions

View File

@ -546,7 +546,7 @@ MAF void mat4_getAngleAxis(mat4 m, float* angle, float* ax, float* ay, float* az
if (fabsf(cosangle) < 1.f - FLT_EPSILON) {
*angle = acosf(cosangle);
} else {
*angle = (float) M_PI;
*angle = cosangle > 0.f ? 0.f : (float) M_PI;
}
*ax = axis[0];
*ay = axis[1];