diff --git a/qpms/cyquaternions.pyx b/qpms/cyquaternions.pyx index 823b82c..0797146 100644 --- a/qpms/cyquaternions.pyx +++ b/qpms/cyquaternions.pyx @@ -2,6 +2,7 @@ from .cybspec cimport BaseSpec from .qpms_cdefs cimport * import cmath import math +import numpy as np def complex_crep(complex c, parentheses = False, shortI = True, has_Imaginary = False): @@ -148,9 +149,22 @@ cdef class CQuat: @staticmethod def from_rotvector(vec): + ''' + Constructs a quaternion representing rotation around a given rotation vector. + + Parameters + ---------- + vec: array_like of shape (3,) + Cartesian components of the rotation vector. + + Returns + ------- + CQuat + ''' + vec = np.array(vec, copy=False) if vec.shape != (3,): raise ValueError("Single 3d vector expected") - res = CQuat() + res = CQuat(0,0,0,0) cdef cart3_t v v.x = vec[0] v.y = vec[1]