v3.5
このクォータニオンの x,Y,Z のオイラー角(ラジアン)を戻します。
警告:JScript、PerlScript、PythonScript など、出力引数をサポートしないスクリプト言語の場合には、SIQuaternion.GetXYZAngleValues2 を使用してください。
SIQuaternion.GetXYZAngleValues( Object& in_vX, Object& in_vY, Object& in_vZ ); |
SIQuaternion.GetXYZAngleValues( x, y, z ); |
option explicit ' CREATE OBJECTS A & B dim A : set A = ActiveSceneRoot.AddNull("A") dim B : set B = ActiveSceneRoot.AddNull("B") ' GET GLOBAL TRANSFORM OF A & B dim gksA : set gksA = A.kinematics.global dim gksB : set gksB = B.kinematics.global dim tgA : set tgA = gksA.transform dim tgB : set tgB = gksB.transform ' TRANSLATE & ROTATE A dim vA : set vA = XSIMath.CreateVector3(2, 2, 0) tgA.SetTranslation vA dim rA : set rA = XSIMath.CreateRotation( 0, 0, XSIMath.DegreesToRadians( 45 ) ) tgA.SetRotation rA gksA.transform = tgA ' GET LOCAL TRANSFORM OF B RELATIVE TO A dim mA : set mA = XSIMath.CreateMatrix3 dim mB : set mB = XSIMath.CreateMatrix3 tgA.GetRotationMatrix3 mA tgB.GetRotationMatrix3 mB mA.TransposeInPlace() mB.MulInPlace mA ' GET ORIENTATION OF B RELATIVE TO A AS A QUATERNION dim qB : set qB = XSIMath.CreateQuaternion mB.GetQuaternion qB ' log result dim x,y,z : qB.GetXYZAngleValues x, y, z Application.LogMessage( "R(" & _ XSIMath.RadiansToDegrees(x) & "," & _ XSIMath.RadiansToDegrees(y) & "," & _ XSIMath.RadiansToDegrees(z) & ")" ) |