import math
import maya.OpenMaya as om
# x,y,z
rot = [90, 90, 90]
# オイラー角を作成
euler = om.MEulerRotation(math.radians(rot[0]), math.radians(rot[1]), math.radians(rot[2]), om.MEulerRotation.kXYZ)
# オイラー角をクォータニオンに変換する
quat = euler.asQuaternion()
print quat.x, quat.y, quat.z, quat.w
# クォータニオンをオイラー角に変換する
euler = quat.asEulerRotation()
print math.degrees(euler.x), math.degrees(euler.y), math.degrees(euler.z)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme