from_matrix
Specification
Location | Author | Maintained by |
---|---|---|
isl/math/quaternion.py | Kenny Erleben | DIKU |
Purpose & Params
Converts an euler rotation matrix to a quaternion.
Example
import numpy as np
# Cosider the case where we want to convert a euler roation matrix, that
# rotates 90 degrees on the x-axis
radian = (0.5*np.pi)/2
M = np.array([
[1, 0, 0],
[0, (1-2*(np.sin(radian)**2)), -2*np.cos(radian)*np.sin(radian)],
[0, 2*np.cos(radian)*np.sin(radian), 1-2*(np.sin(radian)**2) ]
])
print(quat.from_matrix(M))
output:
array([ 0.70710678, 0.70710678, 0. , 0. ])