2010-04-11 14:22:27 +00:00
|
|
|
import mathutils
|
2010-06-23 02:42:39 +00:00
|
|
|
from math import radians
|
2010-01-31 21:52:26 +00:00
|
|
|
|
2010-07-11 16:12:32 +00:00
|
|
|
vec = mathutils.Vector((1.0, 2.0, 3.0))
|
2010-01-31 21:52:26 +00:00
|
|
|
|
2011-02-05 09:57:02 +00:00
|
|
|
mat_rot = mathutils.Matrix.Rotation(radians(90.0), 4, 'X')
|
2010-08-17 14:56:10 +00:00
|
|
|
mat_trans = mathutils.Matrix.Translation(vec)
|
2010-01-31 21:52:26 +00:00
|
|
|
|
|
|
|
mat = mat_trans * mat_rot
|
|
|
|
mat.invert()
|
|
|
|
|
2011-02-05 09:57:02 +00:00
|
|
|
mat3 = mat.to_3x3()
|
|
|
|
quat1 = mat.to_quaternion()
|
|
|
|
quat2 = mat3.to_quaternion()
|
2010-01-31 21:52:26 +00:00
|
|
|
|
2011-04-04 05:47:04 +00:00
|
|
|
quat_diff = quat1.rotation_difference(quat2)
|
2010-01-31 21:52:26 +00:00
|
|
|
|
2011-04-04 05:47:04 +00:00
|
|
|
print(quat_diff.angle)
|