r = np.sqrt(x**2 + y**2 + z**2) if r > 0: theta = np.arccos(z / r) else: theta = 0 theta = np.arccos(z / r) if r > 0 else 0 if x == 0: if y == 0: # along the z axis @@ -835,10 +832,7 @@ def _rotate_to_direction(self) -> None: x, y, z...
//! compute the Frobenius norm of a matrix (or Euclidean norm of a vector) template <typename Scalar, int M, int N> inline Scalar norm(const Matrix<Scalar, M, N>& m) { return sqrt(sqrnorm(m)); } //--- //! compute the squared Frobenius norm of a matrix (or squared Euclidean...