// Define 2 quaternion orientations using degrees radian
var qA = XSIMath.CreateQuaternion();
qA.SetFromXYZAngleValues(
XSIMath.DegreesToRadians(0),
XSIMath.DegreesToRadians(0),
XSIMath.DegreesToRadians(90) );
var qB = XSIMath.CreateQuaternion();
qB.SetFromXYZAngleValues(
XSIMath.DegreesToRadians(0),
XSIMath.DegreesToRadians(0),
XSIMath.DegreesToRadians(180) );
// Do a sperical linear interpolation 50% between A & B
// and log results.
var qC = XSIMath.CreateQuaternion();
qC.Slerp( qA, qB, 0.5 );
Application.LogMessage( "Q[" +
qC.w + "," +
qC.x + ", V(" +
qC.y + "," +
qC.z + ")" +
"]" );
var aXYZ = new VBArray(qC.GetXYZAngleValues2()).toArray();
Application.LogMessage( "R(" +
XSIMath.RadiansToDegrees(aXYZ[0]) + "," +
XSIMath.RadiansToDegrees(aXYZ[1]) + "," +
XSIMath.RadiansToDegrees(aXYZ[2]) + ")" ); |