Fix CQuat.from_rotvector()
This commit is contained in:
parent
cf2aca7f03
commit
36c5d5236a
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue