Quaternion

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Functions
Quaternion
Eina » Data Types » Containers

## Data Structures
struct | _Eina_Quaternion
struct | _Eina_Quaternion_F16p16
struct | _Eina_Point_3D
struct | _Eina_Point_3D_F16p16

## Typedefs
typedef struct _Eina_Quaternion_F16p16 | Eina_Quaternion_F16p16
typedef struct _Eina_Quaternion | Eina_Quaternion
typedef struct _Eina_Point_3D | Eina_Point_3D
typedef struct _Eina_Point_3D_F16p16 | Eina_Point_3D_F16p16

## Functions
EINA_API void | eina_quaternion_f16p16_set (Eina_Quaternion *out, Eina_F16p16 x, Eina_F16p16 y, Eina_F16p16 z, Eina_F16p16 w)
EINA_API Eina_F16p16 | eina_quaternion_f16p16_norm (const Eina_Quaternion_F16p16 *q)
EINA_API void | eina_quaternion_f16p16_negative (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *in)
EINA_API void | eina_quaternion_f16p16_add (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b)
EINA_API void | eina_quaternion_f16p16_mul (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b)
EINA_API void | eina_quaternion_f16p16_scale (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, Eina_F16p16 b)
EINA_API void | eina_quaternion_f16p16_conjugate (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *in)
EINA_API Eina_F16p16 | eina_quaternion_f16p16_dot (const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b)
EINA_API void | eina_quaternion_f16p16_lerp (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b, Eina_F16p16 pos)
EINA_API void | eina_quaternion_f16p16_slerp (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b, Eina_F16p16 pos)
EINA_API void | eina_quaternion_f16p16_nlerp (Eina_Quaternion_F16p16 *out, const Eina_Quaternion_F16p16 *a, const Eina_Quaternion_F16p16 *b, Eina_F16p16 pos)
EINA_API void | eina_quaternion_f16p16_rotate (Eina_Point_3D_F16p16 *p, const Eina_Point_3D_F16p16 *center, const Eina_Quaternion_F16p16 *q)
EINA_API void | eina_quaternion_f16p16_rotation_matrix3_get (Eina_Matrix3_F16p16 *m, const Eina_Quaternion_F16p16 *q)
EINA_API void | eina_quaternion_set (Eina_Quaternion *q, double x, double y, double z, double w)
EINA_API double | eina_quaternion_norm (const Eina_Quaternion *q)
EINA_API void | eina_quaternion_negative (Eina_Quaternion *out, const Eina_Quaternion *in)
EINA_API void | eina_quaternion_add (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b)
EINA_API void | eina_quaternion_mul (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b)
EINA_API void | eina_quaternion_scale (Eina_Quaternion *out, const Eina_Quaternion *a, double b)
EINA_API void | eina_quaternion_conjugate (Eina_Quaternion *out, const Eina_Quaternion *in)
EINA_API double | eina_quaternion_dot (const Eina_Quaternion *a, const Eina_Quaternion *b)
EINA_API void | eina_quaternion_normalized (Eina_Quaternion *out, const Eina_Quaternion *in)
EINA_API void | eina_quaternion_lerp (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b, double pos)
EINA_API void | eina_quaternion_slerp (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b, double pos)
EINA_API void | eina_quaternion_nlerp (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b, double pos)
EINA_API void | eina_quaternion_rotate (Eina_Point_3D *p, const Eina_Point_3D *center, const Eina_Quaternion *q)
EINA_API void | eina_quaternion_rotation_matrix3_get (Eina_Matrix3 *m, const Eina_Quaternion *q)
EINA_API void | eina_matrix3_quaternion_get (Eina_Quaternion *q, const Eina_Matrix3 *m)
EINA_API Eina_Bool | eina_matrix4_quaternion_to (Eina_Quaternion *rotation, Eina_Quaternion *perspective, Eina_Point_3D *translation, Eina_Point_3D *scale, Eina_Point_3D *skew, const Eina_Matrix4 *m)
EINA_API void | eina_quaternion_matrix4_to (Eina_Matrix4 *m, const Eina_Quaternion *rotation, const Eina_Quaternion *perspective, const Eina_Point_3D *translation, const Eina_Point_3D *scale, const Eina_Point_3D *skew)
EINA_API void | eina_quaternion_inverse (Eina_Quaternion *out, const Eina_Quaternion *q)
| Compute the inverse of the given quaternion.
EINA_API void | eina_quaternion_array_set (Eina_Quaternion *dst, const double *v)
| Set array to quaternion.
EINA_API void | eina_quaternion_copy (Eina_Quaternion *dst, const Eina_Quaternion *src)
| Copy quaternion.
EINA_API void | eina_quaternion_homogeneous_regulate (Eina_Quaternion *out, const Eina_Quaternion *v)
| Homogeneous quaternion.
EINA_API void | eina_quaternion_subtract (Eina_Quaternion *out, const Eina_Quaternion *a, const Eina_Quaternion *b)
| Subtract two quaternions.
EINA_API double | eina_quaternion_length_get (const Eina_Quaternion *v)
| Return the length of the given quaternion.
EINA_API double | eina_quaternion_length_square_get (const Eina_Quaternion *v)
| Return the length in square of the given quaternion.
EINA_API double | eina_quaternion_distance_get (const Eina_Quaternion *a, const Eina_Quaternion *b)
| Return the distance between of two quaternions.
EINA_API double | eina_quaternion_distance_square_get (const Eina_Quaternion *a, const Eina_Quaternion *b)
| Return the distance in square between of two quaternions.
EINA_API void | eina_quaternion_transform (Eina_Quaternion *out, const Eina_Quaternion *v, const Eina_Matrix4 *m)
| Transform quaternion.
EINA_API double | eina_quaternion_angle_plains (Eina_Quaternion *a, Eina_Quaternion *b)
| Return the angle plains between of two quaternions.

## Detailed Description

## Function Documentation

## ◆ eina_quaternion_f16p16_set()

EINA_API void eina_quaternion_f16p16_set | ( | Eina_Quaternion * | out,
|  | Eina_F16p16 | x,
|  | Eina_F16p16 | y,
|  | Eina_F16p16 | z,
|  | Eina_F16p16 | w
| ) |  |

Since
  1.15

## ◆ eina_quaternion_f16p16_norm()

EINA_API Eina_F16p16 eina_quaternion_f16p16_norm | ( | const Eina_Quaternion_F16p16 * | q | ) |

Since
  1.15

References eina_f16p16_add(), eina_f16p16_mul(), and eina_f16p16_sqrt().

## ◆ eina_quaternion_f16p16_negative()

EINA_API void eina_quaternion_f16p16_negative | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | in
| ) |  |

Since
  1.15

References eina_f16p16_sub().

Referenced by eina_quaternion_f16p16_nlerp(), and eina_quaternion_f16p16_slerp().

## ◆ eina_quaternion_f16p16_add()

EINA_API void eina_quaternion_f16p16_add | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b
| ) |  |

Since
  1.15

References eina_f16p16_add().

Referenced by eina_quaternion_f16p16_nlerp(), and eina_quaternion_f16p16_slerp().

## ◆ eina_quaternion_f16p16_mul()

EINA_API void eina_quaternion_f16p16_mul | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b
| ) |  |

Since
  1.15

References eina_f16p16_add(), eina_f16p16_mul(), and eina_f16p16_sub().

## ◆ eina_quaternion_f16p16_scale()

EINA_API void eina_quaternion_f16p16_scale | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | Eina_F16p16 | b
| ) |  |

Since
  1.15

References eina_f16p16_scale().

Referenced by eina_quaternion_f16p16_nlerp(), and eina_quaternion_f16p16_slerp().

## ◆ eina_quaternion_f16p16_conjugate()

EINA_API void eina_quaternion_f16p16_conjugate | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | in
| ) |  |

Since
  1.15

References eina_f16p16_sub().

## ◆ eina_quaternion_f16p16_dot()

EINA_API Eina_F16p16 eina_quaternion_f16p16_dot | ( | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b
| ) |  |

Since
  1.15

References eina_f16p16_add(), and eina_f16p16_mul().

Referenced by eina_quaternion_f16p16_nlerp(), and eina_quaternion_f16p16_slerp().

## ◆ eina_quaternion_f16p16_lerp()

EINA_API void eina_quaternion_f16p16_lerp | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b,
|  | Eina_F16p16 | pos
| ) |  |

Since
  1.15

References eina_f16p16_add(), eina_f16p16_int_from(), eina_f16p16_mul(), and eina_f16p16_sub().

## ◆ eina_quaternion_f16p16_slerp()

EINA_API void eina_quaternion_f16p16_slerp | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b,
|  | Eina_F16p16 | pos
| ) |  |

Since
  1.15

References eina_f16p16_double_to(), eina_f16p16_float_from(), eina_f16p16_int_from(), eina_f16p16_sub(), eina_f16p16_to_f32p32(), eina_f32p32_div(), eina_f32p32_double_from(), eina_f32p32_mul(), eina_f32p32_sin(), eina_f32p32_to_f16p16(), eina_quaternion_f16p16_add(), eina_quaternion_f16p16_dot(), eina_quaternion_f16p16_negative(), and eina_quaternion_f16p16_scale().

## ◆ eina_quaternion_f16p16_nlerp()

EINA_API void eina_quaternion_f16p16_nlerp | ( | Eina_Quaternion_F16p16 * | out,
|  | const Eina_Quaternion_F16p16 * | a,
|  | const Eina_Quaternion_F16p16 * | b,
|  | Eina_F16p16 | pos
| ) |  |

Since
  1.15

References eina_f16p16_int_from(), eina_f16p16_sub(), eina_quaternion_f16p16_add(), eina_quaternion_f16p16_dot(), eina_quaternion_f16p16_negative(), and eina_quaternion_f16p16_scale().

## ◆ eina_quaternion_f16p16_rotate()

EINA_API void eina_quaternion_f16p16_rotate | ( | Eina_Point_3D_F16p16 * | p,
|  | const Eina_Point_3D_F16p16 * | center,
|  | const Eina_Quaternion_F16p16 * | q
| ) |  |

Since
  1.15

References eina_f16p16_add(), eina_f16p16_mul(), eina_f16p16_scale(), and eina_f16p16_sub().

## ◆ eina_quaternion_f16p16_rotation_matrix3_get()

EINA_API void eina_quaternion_f16p16_rotation_matrix3_get | ( | Eina_Matrix3_F16p16 * | m,
|  | const Eina_Quaternion_F16p16 * | q
| ) |  |

Since
  1.15

References eina_f16p16_add(), eina_f16p16_int_to(), eina_f16p16_mul(), eina_f16p16_scale(), and eina_f16p16_sub().

## ◆ eina_quaternion_norm()

EINA_API double eina_quaternion_norm | ( | const Eina_Quaternion * | q | ) |

Since
  1.15

Referenced by eina_quaternion_normalized().

## ◆ eina_quaternion_negative()

EINA_API void eina_quaternion_negative | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | in
| ) |  |

Since
  1.15

Referenced by eina_quaternion_nlerp(), and eina_quaternion_slerp().

## ◆ eina_quaternion_add()

EINA_API void eina_quaternion_add | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Since
  1.15

Referenced by eina_quaternion_nlerp(), and eina_quaternion_slerp().

## ◆ eina_quaternion_mul()

EINA_API void eina_quaternion_mul | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Since
  1.15

## ◆ eina_quaternion_scale()

EINA_API void eina_quaternion_scale | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | double | b
| ) |  |

Since
  1.15

Referenced by eina_quaternion_nlerp(), eina_quaternion_normalized(), and eina_quaternion_slerp().

## ◆ eina_quaternion_conjugate()

EINA_API void eina_quaternion_conjugate | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | in
| ) |  |

Since
  1.15

## ◆ eina_quaternion_dot()

EINA_API double eina_quaternion_dot | ( | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Since
  1.15

Referenced by eina_quaternion_nlerp(), and eina_quaternion_slerp().

## ◆ eina_quaternion_normalized()

EINA_API void eina_quaternion_normalized | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | in
| ) |  |

Since
  1.15

References eina_quaternion_norm(), and eina_quaternion_scale().

Referenced by eina_quaternion_nlerp().

## ◆ eina_quaternion_lerp()

EINA_API void eina_quaternion_lerp | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b,
|  | double | pos
| ) |  |

Since
  1.15

References EINA_DBL_EQ.

## ◆ eina_quaternion_slerp()

EINA_API void eina_quaternion_slerp | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b,
|  | double | pos
| ) |  |

Since
  1.15

References EINA_DBL_EQ, eina_quaternion_add(), eina_quaternion_dot(), eina_quaternion_negative(), and eina_quaternion_scale().

## ◆ eina_quaternion_nlerp()

EINA_API void eina_quaternion_nlerp | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b,
|  | double | pos
| ) |  |

Since
  1.15

References EINA_DBL_EQ, eina_quaternion_add(), eina_quaternion_dot(), eina_quaternion_negative(), eina_quaternion_normalized(), and eina_quaternion_scale().

## ◆ eina_quaternion_rotate()

EINA_API void eina_quaternion_rotate | ( | Eina_Point_3D * | p,
|  | const Eina_Point_3D * | center,
|  | const Eina_Quaternion * | q
| ) |  |

Since
  1.15

## ◆ eina_quaternion_rotation_matrix3_get()

EINA_API void eina_quaternion_rotation_matrix3_get | ( | Eina_Matrix3 * | m,
|  | const Eina_Quaternion * | q
| ) |  |

Since
  1.15

## ◆ eina_matrix3_quaternion_get()

EINA_API void eina_matrix3_quaternion_get | ( | Eina_Quaternion * | q,
|  | const Eina_Matrix3 * | m
| ) |  |

Since
  1.15

## ◆ eina_matrix4_quaternion_to()

EINA_API Eina_Bool eina_matrix4_quaternion_to | ( | Eina_Quaternion * | rotation,
|  | Eina_Quaternion * | perspective,
|  | Eina_Point_3D * | translation,
|  | Eina_Point_3D * | scale,
|  | Eina_Point_3D * | skew,
|  | const Eina_Matrix4 * | m
| ) |  |

Since
  1.16

References EINA_DBL_EQ, EINA_FALSE, eina_matrix4_determinant(), eina_matrix4_inverse(), eina_matrix4_transpose(), and EINA_TRUE.

## ◆ eina_quaternion_matrix4_to()

EINA_API void eina_quaternion_matrix4_to | ( | Eina_Matrix4 * | m,
|  | const Eina_Quaternion * | rotation,
|  | const Eina_Quaternion * | perspective,
|  | const Eina_Point_3D * | translation,
|  | const Eina_Point_3D * | scale,
|  | const Eina_Point_3D * | skew
| ) |  |

Since
  1.16

References EINA_DBL_EQ, eina_matrix4_identity(), and eina_matrix4_multiply().

## ◆ eina_quaternion_inverse()

EINA_API void eina_quaternion_inverse | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | q
| ) |  |

Compute the inverse of the given quaternion.

Parameters

  [out] | out | The quaternion to invert.
  [in] | q | The quaternion matrix.

This function inverses the quaternion `q` and stores the result in `out`.

Since
  1.17

## ◆ eina_quaternion_array_set()

EINA_API void eina_quaternion_array_set | ( | Eina_Quaternion * | dst,
|  | const double * | v
| ) |  |

Set array to quaternion.

Parameters

  [out] | dst | The result quaternion
  [in] | v | The the array[4] for set

Set to quaternion first 4 elements from array

Since
  1.17

## ◆ eina_quaternion_copy()

EINA_API void eina_quaternion_copy | ( | Eina_Quaternion * | dst,
|  | const Eina_Quaternion * | src
| ) |  |

Copy quaternion.

Parameters

  [out] | dst | The quaternion copy
  [in] | src | The quaternion for copy.

Since
  1.17

Referenced by eina_quaternion_transform().

## ◆ eina_quaternion_homogeneous_regulate()

EINA_API void eina_quaternion_homogeneous_regulate | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | v
| ) |  |

Homogeneous quaternion.

Parameters

  [out] | out | The resulting quaternion
  [in] | v | The given quaternion

Since
  1.17

References EINA_DBL_EQ.

## ◆ eina_quaternion_subtract()

EINA_API void eina_quaternion_subtract | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Subtract two quaternions.

Parameters

  [out] | out | The resulting quaternion
  [in] | a | The first member of the subtract
  [in] | b | The second member of the subtract

Since
  1.17

Referenced by eina_quaternion_distance_get(), and eina_quaternion_distance_square_get().

## ◆ eina_quaternion_length_get()

EINA_API double eina_quaternion_length_get | ( | const Eina_Quaternion * | v | ) |

Return the length of the given quaternion.

Parameters

  [out] | v | The quaternion.

Returns
  The length.

Since
  1.17

Referenced by eina_quaternion_distance_get().

## ◆ eina_quaternion_length_square_get()

EINA_API double eina_quaternion_length_square_get | ( | const Eina_Quaternion * | v | ) |

Return the length in square of the given quaternion.

Parameters

  [out] | v | The quaternion.

Returns
  The length in square.

Since
  1.17

Referenced by eina_quaternion_distance_square_get().

## ◆ eina_quaternion_distance_get()

EINA_API double eina_quaternion_distance_get | ( | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Return the distance between of two quaternions.

Parameters

  [in] | a | The first quaternion.
  [in] | b | The second quaternion.

Returns
  The distance.

Since
  1.17

References eina_quaternion_length_get(), and eina_quaternion_subtract().

## ◆ eina_quaternion_distance_square_get()

EINA_API double eina_quaternion_distance_square_get | ( | const Eina_Quaternion * | a,
|  | const Eina_Quaternion * | b
| ) |  |

Return the distance in square between of two quaternions.

Parameters

  [in] | a | The first quaternion.
  [in] | b | The second quaternion.

Returns
  The distance in square.

Since
  1.17

References eina_quaternion_length_square_get(), and eina_quaternion_subtract().

## ◆ eina_quaternion_transform()

EINA_API void eina_quaternion_transform | ( | Eina_Quaternion * | out,
|  | const Eina_Quaternion * | v,
|  | const Eina_Matrix4 * | m
| ) |  |

Transform quaternion.

Parameters

  [out] | out | The result quaternion.
  [in] | v | The quaternion for transform.
  [in] | m | The matrix for transform.

Since
  1.17

References eina_matrix4_type_get(), EINA_MATRIX_TYPE_IDENTITY, and eina_quaternion_copy().

## ◆ eina_quaternion_angle_plains()

EINA_API double eina_quaternion_angle_plains | ( | Eina_Quaternion * | a,
|  | Eina_Quaternion * | b
| ) |  |

Return the angle plains between of two quaternions.

Parameters

  [in] | a | The first quaternion.
  [in] | b | The second quaternion.

Returns
  The angle.

Since
  1.17