Add comment about efficiency in vector_normalize

This commit is contained in:
Eryn Wells 2013-09-08 15:18:48 -07:00
parent 5a0d215789
commit d636a4f2ee

View file

@ -115,6 +115,7 @@ vector_normalize(Vector3 v)
return v;
}
// Multiplying by the inverse of the length is more efficient than dividing by the length.
float inverse_length = 1 / sqrt(length2);
return vector_init(v.x * inverse_length, v.y * inverse_length, v.z * inverse_length);
}