normalize - chung-leong/qb GitHub Wiki

normalize - Normalized vector

float[] normalize( float[] $x )

normalize() normalizes the vector x. Each of the vector's components is divided by the length of the vector. The resultant vector will point in the same direction as x but has a length of 1.

Parameters:

x - The vector to process. It can be a one-dimensional array or a multi-dimensional array.

Return Value:

Normalized x. The size of the return value will match that of x.

Version

1.0 and above.