Coverage for navipy/maths/tools.py : 59%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" """
"""Return Euclidean norm of ndarray along axis. """ data = np.array(data)
"""Return ndarray normalized by length, i.e. Euclidean norm, along axis. """
"""Return angle between vectors.
If directed is False, the input vectors are interpreted as undirected axes, i.e. the maximum angle is pi/2. """ vector_0 = np.array(vector_0, dtype=np.float64, copy=False) vector_1 = np.array(vector_1, dtype=np.float64, copy=False) dot = np.sum(vector_0 * vector_1, axis=axis, keepdims=True) dot /= vector_norm(vector_0, axis=axis) \ * vector_norm(vector_1, axis=axis) dot = np.squeeze(dot) return np.arccos(dot if directed else np.fabs(dot))
"""Return inverse of square transformation matrix. """ return np.linalg.inv(matrix)
"""Return concatenation of series of transformation matrices. """ M = np.identity(4) for i in matrices: M = np.dot(M, i) return M |