pyrobopath.tools.linalg.unit_vector#

pyrobopath.tools.linalg.unit_vector(vec: ndarray[tuple[Any, ...], dtype[_ScalarT]]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]#

Returns the vector of unit magnitude in the direction of vec

Parameters:

vec (NDArray) – the vector to normalize

Returns:

vector in the direction of vec with magnitude 1

Return type:

NDArray

Raises:

ValueError – if the input vector has zero magnitude