Browse Source

Don't call sqrtf when axis already normalized (#1672)

pull/1673/head
Dan Bechard 3 years ago
committed by GitHub
parent
commit
5325d8d2ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/raymath.h

+ 6
- 6
src/raymath.h View File

@ -856,14 +856,14 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle)
float x = axis.x, y = axis.y, z = axis.z;
float length = sqrtf(x*x + y*y + z*z);
float lengthSquared = x*x + y*y + z*z;
if ((length != 1.0f) && (length != 0.0f))
if ((lengthSquared != 1.0f) && (lengthSquared != 0.0f))
{
n">length = 1.0f/length;
x *= length;
y *= length;
z *= length;
kt">float inverseLength = 1.0f/sqrtf(lengthSquared);
x *= inverseLength;
y *= inverseLength;
z *= inverseLength;
}
float sinres = sinf(angle);

Loading…
Cancel
Save