summaryrefslogtreecommitdiff
path: root/3dmath.c
diff options
context:
space:
mode:
Diffstat (limited to '3dmath.c')
-rw-r--r--3dmath.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/3dmath.c b/3dmath.c
index d5806b6..5b876f2 100644
--- a/3dmath.c
+++ b/3dmath.c
@@ -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