SIQuaternion.GetXYZAngleValues2

導入

v3.5

詳細

このクォータニオンの x,Y,Z のオイラー角(ラジアン)を、配列で戻します。

スクリプト 構文

oArray = SIQuaternion.GetXYZAngleValues2();

戻り値

Array

JScript の例

// CREATE OBJECTS A & B
        var A = ActiveSceneRoot.AddNull("A");
        var B = ActiveSceneRoot.AddNull("B");
        // GET GLOBAL TRANSFORM OF A & B
        var gksA = A.kinematics.global; 
        var gksB = B.kinematics.global; 
        var tgA = gksA.transform;
        var tgB = gksB.transform;
        // TRANSLATE & ROTATE A
        var vA = XSIMath.CreateVector3(2, 2, 0);
        tgA.SetTranslation( vA );               
        var rA = XSIMath.CreateRotation();
        rA.SetFromXYZAnglesValues( 0, 0, XSIMath.DegreesToRadians( 45 ) ); 
        tgA.SetRotation( rA );          
        gksA.transform = tgA;
        // GET LOCAL TRANSFORM OF B RELATIVE TO A
        var mA = XSIMath.CreateMatrix3();
        var mB = XSIMath.CreateMatrix3();
        tgA.GetRotationMatrix3(mA);
        tgB.GetRotationMatrix3(mB);
        mA.TransposeInPlace();
        mB.MulInPlace( mA );
        // GET ORIENTATION OF B RELATIVE TO A AS A QUATERNION
        var qB = XSIMath.CreateQuaternion();
        mB.GetQuaternion(qB);
        // log result
        var aXYZ = new VBArray(qB.GetXYZAngleValues2()).toArray();
        Application.LogMessage( "R(" + 
                XSIMath.RadiansToDegrees(aXYZ[0]) + "," +
                XSIMath.RadiansToDegrees(aXYZ[1]) + "," + 
                XSIMath.RadiansToDegrees(aXYZ[2]) + ")" );

関連項目

SIQuaternion.GetXYZAngleValues SIQuaternion.SetFromXYZAngleValues