|
Banjo API 1.0.0-rc.2
Low-level C99 game development API
|
Go to the source code of this file.
Functions | |
| static struct bj_vec4 | bj_quat_identity (void) |
| static bj_real | bj_quat_dot (struct bj_vec4 a, struct bj_vec4 b) |
| static bj_real | bj_quat_norm2 (struct bj_vec4 q) |
| static bj_real | bj_quat_norm (struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_normalize (struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_conjugate (struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_inverse (struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_mul (struct bj_vec4 p, struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_slerp (struct bj_vec4 a, struct bj_vec4 b, bj_real t) |
| static struct bj_vec4 | bj_quat_from_axis_angle (struct bj_vec3 axis, bj_real angle_rad) |
| static struct bj_vec3 | bj_quat_rotate_vec3 (struct bj_vec4 q, struct bj_vec3 v) |
| static struct bj_vec4 | bj_quat_rotate_vec4 (struct bj_vec4 q, struct bj_vec4 v) |
| static void | bj_quat_to_mat4 (struct bj_mat4x4 *restrict M, struct bj_vec4 q) |
| static struct bj_vec4 | bj_quat_from_mat4 (const struct bj_mat4x4 *restrict M) |
Quaternion manipulation API (by-value, sharing struct bj_vec4 storage).
Quaternions and 4D vectors have the same shape (four bj_real components) so Banjo reuses bj_vec4 as the storage for both rather than introducing a parallel struct. A quaternion q has its vector part in q.x, q.y, q.z and its scalar part in q.w. The bj_quat_* functions in this header treat that layout as a quaternion and apply rotation algebra; the bj_vec4_* functions in vec.h treat the same bytes as a 4D vector and apply linear algebra. (The public typedef bj_quat in <banjo/api.h> is an alias for the same struct bj_vec4, available when BJ_NO_TYPEDEF isn't defined.)
The API is pass-by-value: every quaternion argument and return is a struct bj_vec4 taken or returned by copy, which suits the 4-component size and lets the compiler inline aggressively.
Conventions:
What's provided:
Definition in file quat.h.