rs_quaternion.rsh File Reference

- Overview
- Globals
- Structs

Functions
rs_quaternion.rsh File Reference

## Functions
static void | rsQuaternionSet (rs_quaternion *q, float w, float x, float y, float z)
static void | rsQuaternionSet (rs_quaternion *q, const rs_quaternion *rhs)
static void | rsQuaternionMultiply (rs_quaternion *q, float s)
static void | rsQuaternionAdd (rs_quaternion *q, const rs_quaternion *rhs)
static void | rsQuaternionLoadRotateUnit (rs_quaternion *q, float rot, float x, float y, float z)
static void | rsQuaternionLoadRotate (rs_quaternion *q, float rot, float x, float y, float z)
static void | rsQuaternionConjugate (rs_quaternion *q)
static float | rsQuaternionDot (const rs_quaternion *q0, const rs_quaternion *q1)
static void | rsQuaternionNormalize (rs_quaternion *q)
static void | rsQuaternionMultiply (rs_quaternion *q, const rs_quaternion *rhs)
static void | rsQuaternionSlerp (rs_quaternion *q, const rs_quaternion *q0, const rs_quaternion *q1, float t)
static void | rsQuaternionGetMatrixUnit (rs_matrix4x4 *m, const rs_quaternion *q)

## Detailed Description

Quaternion routines.

Definition in file rs_quaternion.rsh.

## Function Documentation

static void rsQuaternionAdd | ( | rs_quaternion * | q,
|  | const rs_quaternion * | rhs
| ) |  | `[static]`

Add two quaternions

Parameters:

  q | destination quaternion to add to
  rsh | right hand side quaternion to add

Definition at line 74 of file rs_quaternion.rsh.

static void rsQuaternionConjugate | ( | rs_quaternion * | q | ) | `[static]`

Conjugates the quaternion

Parameters:

  q | quaternion to conjugate

Definition at line 127 of file rs_quaternion.rsh.

static float rsQuaternionDot | ( | const rs_quaternion * | q0,
|  | const rs_quaternion * | q1
| ) |  | `[static]`

Dot product of two quaternions

Parameters:

  q0 | first quaternion
  q1 | second quaternion

Returns:
  dot product between q0 and q1

Definition at line 140 of file rs_quaternion.rsh.

static void rsQuaternionGetMatrixUnit | ( | rs_matrix4x4 * | m,
|  | const rs_quaternion * | q
| ) |  | `[static]`

Computes rotation matrix from the normalized quaternion

Parameters:

  m | resulting matrix
  p | normalized quaternion

Definition at line 228 of file rs_quaternion.rsh.

static void rsQuaternionLoadRotate | ( | rs_quaternion * | q,
|  | float | rot,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  | `[static]`

Loads a quaternion that represents a rotation about an arbitrary vector (doesn't have to be unit)

Parameters:

  q | quaternion to set
  rot | angle to rotate by
  x | component of a vector
  y | component of a vector
  x | component of a vector

Definition at line 111 of file rs_quaternion.rsh.

static void rsQuaternionLoadRotateUnit | ( | rs_quaternion * | q,
|  | float | rot,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  | `[static]`

Loads a quaternion that represents a rotation about an arbitrary unit vector

Parameters:

  q | quaternion to set
  rot | angle to rotate by
  x | component of a vector
  y | component of a vector
  x | component of a vector

Definition at line 90 of file rs_quaternion.rsh.

static void rsQuaternionMultiply | ( | rs_quaternion * | q,
|  | float | s
| ) |  | `[static]`

Multiply quaternion by a scalar

Parameters:

  q | quaternion to multiply
  s | scalar

Definition at line 61 of file rs_quaternion.rsh.

static void rsQuaternionMultiply | ( | rs_quaternion * | q,
|  | const rs_quaternion * | rhs
| ) |  | `[static]`

Multiply quaternion by another quaternion

Parameters:

  q | destination quaternion
  rhs | right hand side quaternion to multiply by

Definition at line 163 of file rs_quaternion.rsh.

static void rsQuaternionNormalize | ( | rs_quaternion * | q | ) | `[static]`

Normalizes the quaternion

Parameters:

  q | quaternion to normalize

Definition at line 149 of file rs_quaternion.rsh.

static void rsQuaternionSet | ( | rs_quaternion * | q,
|  | float | w,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  | `[static]`

Set the quaternion components

Parameters:

  w | component
  x | component
  y | component
  z | component

Definition at line 35 of file rs_quaternion.rsh.

static void rsQuaternionSet | ( | rs_quaternion * | q,
|  | const rs_quaternion * | rhs
| ) |  | `[static]`

Set the quaternion from another quaternion

Parameters:

  q | destination quaternion
  rhs | source quaternion

Definition at line 48 of file rs_quaternion.rsh.

static void rsQuaternionSlerp | ( | rs_quaternion * | q,
|  | const rs_quaternion * | q0,
|  | const rs_quaternion * | q1,
|  | float | t
| ) |  | `[static]`

Performs spherical linear interpolation between two quaternions

Parameters:

  q | result quaternion from interpolation
  q0 | first param
  q1 | second param
  t | how much to interpolate by

Definition at line 182 of file rs_quaternion.rsh.