git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13066
d7cf8633-e32d-0410-b094-
e92efae38249
// 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;
-
}