Skip to content

Latest commit

 

History

History
160 lines (96 loc) · 9.19 KB

class_quat.rst

File metadata and controls

160 lines (96 loc) · 9.19 KB

Quat

Category: Built-In Types

Brief Description

Quaternion.

Member Functions

Quat<class_quat> Quat<class_Quat_Quat> ( float<class_float> x, float<class_float> y, float<class_float> z, float<class_float> w )
Quat<class_quat> Quat<class_Quat_Quat> ( Vector3<class_vector3> axis, float<class_float> angle )
Quat<class_quat> Quat<class_Quat_Quat> ( Basis<class_basis> from )
Quat<class_quat> cubic_slerp<class_Quat_cubic_slerp> ( Quat<class_quat> b, Quat<class_quat> pre_a, Quat<class_quat> post_b, float<class_float> t )
float<class_float> dot<class_Quat_dot> ( Quat<class_quat> b )
Quat<class_quat> inverse<class_Quat_inverse> ( )
bool<class_bool> is_normalized<class_Quat_is_normalized> ( )
float<class_float> length<class_Quat_length> ( )
float<class_float> length_squared<class_Quat_length_squared> ( )
Quat<class_quat> normalized<class_Quat_normalized> ( )
Quat<class_quat> slerp<class_Quat_slerp> ( Quat<class_quat> b, float<class_float> t )
Quat<class_quat> slerpni<class_Quat_slerpni> ( Quat<class_quat> b, float<class_float> t )
Vector3<class_vector3> xform<class_Quat_xform> ( Vector3<class_vector3> v )

Member Variables

  • float<class_float> w - W component of the quaternion. Default value: 1
  • float<class_float> x - X component of the quaternion. Default value: 0
  • float<class_float> y - Y component of the quaternion. Default value: 0
  • float<class_float> z - Z component of the quaternion. Default value: 0

Description

A 4-dimensional vector representing a rotation.

The vector represents a 4 dimensional complex number where multiplication of the basis elements is not commutative (multiplying i with j gives a different result than multiplying j with i).

Multiplying quaternions reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues.

It can be used to perform SLERP (spherical-linear interpolation) between two rotations.

Member Function Description

  • Quat<class_quat> Quat ( float<class_float> x, float<class_float> y, float<class_float> z, float<class_float> w )

Returns a quaternion defined by these values.

  • Quat<class_quat> Quat ( Vector3<class_vector3> axis, float<class_float> angle )

Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.

  • Quat<class_quat> Quat ( Basis<class_basis> from )

Returns the rotation matrix corresponding to the given quaternion.

  • Quat<class_quat> cubic_slerp ( Quat<class_quat> b, Quat<class_quat> pre_a, Quat<class_quat> post_b, float<class_float> t )

Performs a cubic spherical-linear interpolation with another quaternion.

  • float<class_float> dot ( Quat<class_quat> b )

Returns the dot product of two quaternions.

  • Quat<class_quat> inverse ( )

Returns the inverse of the quaternion.

  • bool<class_bool> is_normalized ( )

Returns whether the quaternion is normalized or not.

  • float<class_float> length ( )

Returns the length of the quaternion.

  • float<class_float> length_squared ( )

Returns the length of the quaternion, squared.

  • Quat<class_quat> normalized ( )

Returns a copy of the quaternion, normalized to unit length.

  • Quat<class_quat> slerp ( Quat<class_quat> b, float<class_float> t )

Performs a spherical-linear interpolation with another quaternion.

  • Quat<class_quat> slerpni ( Quat<class_quat> b, float<class_float> t )

Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.

  • Vector3<class_vector3> xform ( Vector3<class_vector3> v )

Transforms the vector v by this quaternion.