rendered paste body--- a/code/qcommon/q_math.c
+++ b/code/qcommon/q_math.c
@@ -819,42 +819,41 @@ qboolean BoundsIntersectPoint(const vec3_t mins, const vec3_t maxs,
origin[2] < mins[2])
{
return qfalse;
}
return qtrue;
}
vec_t VectorNormalize( vec3_t v ) {
- // NOTE: TTimo - Apple G4 altivec source uses double?
float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
- length = sqrt (length);
if ( length ) {
+ length = sqrt (length);
ilength = 1/length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
return length;
}
vec_t VectorNormalize2( const vec3_t v, vec3_t out) {
float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
- length = sqrt (length);
if (length)
{
+ length = sqrt (length);
ilength = 1/length;
out[0] = v[0]*ilength;
out[1] = v[1]*ilength;
out[2] = v[2]*ilength;
} else {
VectorClear( out );
}
return length;