Add comment about efficiency in vector_normalize
This commit is contained in:
parent
5a0d215789
commit
d636a4f2ee
1 changed files with 1 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue