X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=mathlib.c;h=4c19dfe1d38e558af013e23da358031a563bf443;hb=42e86ab7892c3d8f5373402a714b73b2e040d81b;hp=cf9e24a8259a301c8f7706caca5bf84539c5b414;hpb=0a05c446ba26bd5897645a37ceec8646c5bc93eb;p=xonotic%2Fdarkplaces.git diff --git a/mathlib.c b/mathlib.c index cf9e24a8..4c19dfe1 100644 --- a/mathlib.c +++ b/mathlib.c @@ -762,21 +762,14 @@ void AngleMatrix (const vec3_t angles, const vec3_t translate, vec_t matrix[][4] // LadyHavoc: renamed this to Length, and made the normal one a #define float VectorNormalizeLength (vec3_t v) { - float length, ilength; + float length; - length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = sqrt (length); + length = sqrt(DotProduct(v,v)); if (length) - { - ilength = 1/length; - v[0] *= ilength; - v[1] *= ilength; - v[2] *= ilength; - } + VectorScale(v, 1 / length, v); return length; - }