SIQuaternion.Value

Description

Sets or returns a Double representing the ith value of this quaterion, where w is i=0 and x is i=1. Value is the SIQuaternion object's default property, which means that you can call it by just using the parenthesis and leaving out the property name, for example: q(i).

C# Syntax

// get accessor
Double ISIQuaternion.get_Value( Int16 in_nIndex );
// set accessor
ISIQuaternion.set_Value( Int16 in_nIndex, Double pVal );

Parameters

Parameter Type Description
Index Integer Gives a get/set access to the (i)th value of this quaternion

Examples

JScript Example

// create a null and translate, rotate and scale it
GetPrim("Null", null, null);
Translate(null, 1.73296599336766, 3.21359046016228, -0.321359046016228, siRelative, siView, siObj, siXYZ, null, null, null, null, null);
Rotate(null, -102.375, 0, 0, siRelative, siLocal, siObj, siXYZ, null, null, null);
Rotate(null, 0, -22.5, 0, siRelative, siLocal, siObj, siXYZ, null, null, null);
Scale(null, 1.55705996131528, 1.55705996131528, 1.55705996131528, siRelative, siLocal, siObj, siXYZ, null, null, null);
// get object from selection
var o = selection(0);
// get global transform from object
var t = o.kinematics.global.transform;
var q = XSIMath.CreateQuaternion();
t.GetRotationQuaternion( q );
var cCrLf = String.fromCharCode(13,10);
Application.LogMessage( cCrLf +
	round(q.w,3)  + " " + round(q.x,3)  + " " + round(q.y,3)  + " " + round(q.z,3) + cCrLf +
	round(q(0),3)  + " " + round(q(1),3)  + " " + round(q(2),3)  + " " + round(q(3),3) + cCrLf );
function round( n, numdecplaces ) 
{
	var f = Math.pow(10, numdecplaces );
	return Math.round(n * f)/f;
}
//INFO : "
//0.615 -0.764 -0.122 0.152
//0.615 -0.764 -0.122 0.152
//"