diff options
-rw-r--r-- | 3dmath.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -11,13 +11,11 @@ dot(const float x[3], const float y[3]) { void normalize(float x[3]) { - float len; - int i; - - len = sqrt(dot(x, x)); + float len = 1.0f / sqrtf(dot(x, x)); - for(i = 0; i < 3; ++i) - x[i] /= len; + x[0] *= len; + x[1] *= len; + x[2] *= len; } float |