12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Maya | オイラー角、クォータニオン変換

Last updated at Posted at 2016-11-11
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)
12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?