3
1

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-10-21

Mayaの回転順番を変換するには、OpenMayaのreorderを使用する。

次のコードは(X:70, Y:80, Z:90)の回転を回転順番XYZで作成し、後に回転順番YZXに変換している。

import maya.OpenMaya as om
import math

rot = [70, 80, 90]

r = om.MEulerRotation(math.radians(rot[0]), math.radians(rot[1]), math.radians(rot[2]), om.MEulerRotation.kXYZ)
print "before:"
print math.degrees(r.x), math.degrees(r.y), math.degrees(r.z)

r = r.reorder(om.MEulerRotation.kYZX)
print "after:"
print math.degrees(r.x), math.degrees(r.y), math.degrees(r.z)

実行結果

before:
70.0 80.0 90.0
after:
10.0 90.0 20.0

回転順番の指定には次のものがある。

kXYZ
kYZX
kZXY
kXZY
kYXZ
kZYX
3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?