SIRotation.Quaternion
 
 
 

SIRotation.Quaternion

Introduced

v5.1

Description

Sets or returns the SIQuaternion of this rotation (the quaternion is created automatically).

C# Syntax

// get accessor
SIQuaternion rtn = ISIRotation.Quaternion;
// set accessor
ISIRotation.Quaternion = SIQuaternion;

Examples

JScript Example

/*
        This example demonstrates how to use Quaternion property to return the quaternion of the rotation 
        as an SIQuaternion (without having to explicitly create it first) as well as how to set a new quaternion.
*/
var oRot = XSIMath.CreateRotation();
// The Quaternion property takes care of creating oQuat as an SIQuaternion
var oQuat = oRot.Quaternion;
// Now set w, x, y and z normalize properties of the quaternion and then save it back onto the rotation
oQuat.Set(0.5, 0.5, 0.5, 0.5);
oRot.Quaternion = oQuat;
// Get a new quaternion
var oQuatDest = oRot.Quaternion;
Application.LogMessage( " The w,x,y,z quaternion values of this rotation are: " 
                + oQuatDest.W + " " + oQuatDest.X + " " + oQuatDest.Y + " " + oQuatDest.Z );
// Expected results:
//INFO :  The w,x,y,z quaternion values of this rotation are: 0.5 0.5 0.5 0.5

See Also

SIRotation.GetQuaternion SIRotation.SetFromQuaternion