Method CalculateTwistAngle
CalculateTwistAngle(quaternion, int)
Returns the twist angle of the swing-twist decomposition of q about i, j, or k corresponding to index = 0, 1, or 2 respectively. Full calculation for readability: float invLength = RSqrtSafe(dot * dot + w * w); float sinHalfAngle = dot * invLength; float cosHalfAngle = w * invLength; Observe: invLength cancels in the tan^-1(sin / cos) calc, so avoid unnecessary calculations.
Declaration
public static float CalculateTwistAngle(quaternion q, int twistAxisIndex)
Parameters
Type | Name | Description |
---|---|---|
quaternion | q | A quaternion to process. |
int | twistAxisIndex | Zero-based index of the twist axis. |
Returns
Type | Description |
---|---|
float | The calculated twist angle. |