normalize

pyvsim.Utils.normalize(vectors)[source]

This can be used to normalize a vector or a list of vectors, provided they are given as numpy arrays.

Parameters :

vectors : numpy.ndarray \((N,3)\)

A list of vectors to be normalized

Returns :

vectors : numpy.ndarray \((N,3)\)

The normalized vectors

Examples

>>> result = normalize(np.array([2,0,0]))
>>> assert(aeq(result, np.array([1,0,0])))

And for multiple vectors:

>>> result = normalize(np.array([[2,0,0], 
...                              [0,0,1]]))
>>> assert(aeq(result, np.array([[1,0,0], 
...                              [0,0,1]])))

This Page