5.47. Quaternion (transformation)

<transformation geometry="quaternion"> ‐ A quaternion transformation

5.47.1. Attributes

NameTypeDefaults
idIDNone (required)
wFLOAT1.0
xFLOAT0.0
yFLOAT0.0
zFLOAT0.0
matrixFLOAT MATRIXNone (read-only)

5.47.2. Description

This element defines a 3D quaternion.

The float values of the w, x, y, and z attributes define the four coordinates of the quaternion.

The value of the read-only attribute matrix is a 4x4 float matrix that represents the current curve transformation.

5.47.3. Expected child

None.

5.47.4. Example

The following example is the interpolation between two rotations defined by quaternions (a rotation of 60° about (1,1,1) and a rotation of -45° about (1,-1,-1)). Interpolation of quaterions uses spherical linear interpolation SLERP. The shortest path for interpolation is chosen if and only if the attribute of the interpolation element is true.

<node id="transf_quat">
 <interpolator id="transf_quat" type="transformation" size="2" >
  <schedule begin="10000" dur="1" mode="sinus" fill="freeze" 
            ini="1" end="2" repeatCount="1" />
  <transformation id="transf_quat_ini" geometry="quaternion" 
                  w="0.86603" x="0.28868" y="0.28868" z="0.28868" />
  <transformation id="transf_quat_end" geometry="quaternion" 
                  w="0.92388" x="-0.22094" y="0.22094" z="0.22094" />
 </interpolator>