TRotation< FReal, 3 >::ToAxisAndAngleSafe

Extract the axis and angle from the Quaternion.

Choose your operating system:

Windows

macOS

Linux

Warnings

  • The axis calculation cannot succeed for small angles due to numerical error. In this case, the function will return false, but set the axis to DefaultAxis. @note EpsilonSq is approximately the square of the angle below which we cannot calculate the axis. It needs to be "much greater" than square of the error in the quaternion values which is usually ~1e-4, so values around 1e-3^2 = 1e-6 or greater are about right.

References

Module

Chaos

Header

/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Rotation.h

Include

#include "Chaos/Rotation.h"

Syntax

bool ToAxisAndAngleSafe
(
    TVector< FReal, 3 > & OutAxis,
    FReal & OutAngle,
    const TVector< FReal, 3 > & DefaultAxis,
    FReal EpsilionSq
) const

Remarks

Extract the axis and angle from the Quaternion.

The axis calculation cannot succeed for small angles due to numerical error. In this case, the function will return false, but set the axis to DefaultAxis. @note EpsilonSq is approximately the square of the angle below which we cannot calculate the axis. It needs to be "much greater" than square of the error in the quaternion values which is usually ~1e-4, so values around 1e-3^2 = 1e-6 or greater are about right.

Returns

Whether the axis was successfully calculated (true except for very small angles around or less than Epsilon).

Parameters

Parameter

Description

OutAxis

The axis of rotation.

OutAngle

The angle of rotation about the axis (radians).

DefaultAxis

The axis to set when the angle is too small to accurately calculate the axis.

EpsilonSq

The squared tolerance used to check for small angles.