28#define BJ_M3(c,r) ((c)*3 + (r))
37#define BJ_M32(c,r) ((c)*2 + (r))
46#define BJ_M4(c,r) ((c)*4 + (r))
55#define BJ_M43(c,r) ((c)*3 + (r))
77 for (
int i = 0 ; i < 9 ; ++i) {
78 dst->m[i] = src->m[i];
123 for (
int i = 0 ; i<9 ; ++i) {
139 for (
int i = 0 ; i < 9 ; ++i) {
140 out->m[i] = A->m[i] + B->m[i];
155 for (
int i = 0 ; i < 9 ; ++i) {
156 out->m[i] = A->m[i] - B->m[i];
171 for (
int i = 0 ; i < 9 ; ++i) {
172 out->m[i] = A->m[i] * k;
192 for (
int c = 0; c < 3; ++c) {
239 return (
bj_vec2) { rx / w, ry / w };
256 M->m[
BJ_M3(2,0)] = tx;
257 M->m[
BJ_M3(2,1)] = ty;
273 for (
int r = 0 ; r<3 ; ++r) {
275 M->m[
BJ_M3(2,r)] += row.
x * t.
x + row.
y * t.
y + row.
z * t.
z;
291 M->m[
BJ_M3(0,0)] = sx;
292 M->m[
BJ_M3(1,1)] = sy;
307 M->m[
BJ_M3(1,0)] = shy;
308 M->m[
BJ_M3(0,1)] = shx;
383 out->m[
BJ_M3(0,0)] = c00 * id; out->m[
BJ_M3(1,0)] = c01 * id; out->m[
BJ_M3(2,0)] = c02 * id;
384 out->m[
BJ_M3(0,1)] = c10 * id; out->m[
BJ_M3(1,1)] = c11 * id; out->m[
BJ_M3(2,1)] = c12 * id;
385 out->m[
BJ_M3(0,2)] = c20 * id; out->m[
BJ_M3(1,2)] = c21 * id; out->m[
BJ_M3(2,2)] = c22 * id;
416 out->m[
BJ_M3(0,0)] = c00 * id; out->m[
BJ_M3(1,0)] = c01 * id; out->m[
BJ_M3(2,0)] = c02 * id;
417 out->m[
BJ_M3(0,1)] = c10 * id; out->m[
BJ_M3(1,1)] = c11 * id; out->m[
BJ_M3(2,1)] = c12 * id;
418 out->m[
BJ_M3(0,2)] = c20 * id; out->m[
BJ_M3(1,2)] = c21 * id; out->m[
BJ_M3(2,2)] = c22 * id;
444 m[
BJ_M3(2,0)] = -(r+l)/(r-l);
445 m[
BJ_M3(2,1)] = (t+b)/(t-b);
570 out->m[
BJ_M32(0,0)] = a00*b00 + a01*b10;
571 out->m[
BJ_M32(0,1)] = a10*b00 + a11*b10;
572 out->m[
BJ_M32(1,0)] = a00*b01 + a01*b11;
573 out->m[
BJ_M32(1,1)] = a10*b01 + a11*b11;
574 out->m[
BJ_M32(2,0)] = a00*b02 + a01*b12 + a02;
575 out->m[
BJ_M32(2,1)] = a10*b02 + a11*b12 + a12;
695 for(
int i = 0 ; i < 16 ; ++i) {
696 dst->m[i] = src->m[i];
749 for(
int c = 0 ; c < 4; ++c) {
750 for(
int r0 = 0 ; r0 < 4; ++r0) {
754 for(
int i = 0 ; i < 16 ; ++i) {
771 for(
int i = 0 ; i < 16 ; ++i) {
772 out->m[i] = A->m[i] + B->m[i];
788 for(
int i = 0 ; i < 16 ; ++i) {
789 out->m[i] = A->m[i] - B->m[i];
805 for(
int i = 0;i<16;++i) {
806 out->m[i] = A->m[i] * k;
863 for (
int c = 0; c < 4; ++c) {
872 + a[
BJ_M4(3,0)] * b3;
876 + a[
BJ_M4(3,1)] * b3;
880 + a[
BJ_M4(3,2)] * b3;
884 + a[
BJ_M4(3,3)] * b3;
926 M->m[
BJ_M4(3,0)] = x;
927 M->m[
BJ_M4(3,1)] = y;
928 M->m[
BJ_M4(3,2)] = z;
946 for (
int r = 0 ; r<4 ; ++r) {
998 if (len <=
BJ_F(1e-4)) {
1004 const bj_real ux = axis.
x * inv, uy = axis.
y * inv, uz = axis.
z * inv;
1008 const bj_real r00 = c + t*ux*ux;
1009 const bj_real r01 = t*ux*uy + s*uz;
1010 const bj_real r02 = t*ux*uz - s*uy;
1012 const bj_real r10 = t*uy*ux - s*uz;
1013 const bj_real r11 = c + t*uy*uy;
1014 const bj_real r12 = t*uy*uz + s*ux;
1016 const bj_real r20 = t*uz*ux + s*uy;
1017 const bj_real r21 = t*uz*uy - s*ux;
1018 const bj_real r22 = c + t*uz*uz;
1034 for (
int r = 0; r < 4; ++r) {
1035 const bj_real M0 = m0[r], M1 = m1[r], M2 = m2[r];
1036 o0[r] = M0*r00 + M1*r10 + M2*r20;
1037 o1[r] = M0*r01 + M1*r11 + M2*r21;
1038 o2[r] = M0*r02 + M1*r12 + M2*r22;
1068 for (
int r = 0; r < 4; ++r) {
1069 const bj_real M1 = m1[r], M2 = m2[r];
1071 o1[r] = c*M1 - s*M2;
1072 o2[r] = s*M1 + c*M2;
1101 for (
int r = 0; r < 4; ++r) {
1102 const bj_real M0 = m0[r], M2 = m2[r];
1103 o0[r] = c*M0 + s*M2;
1105 o2[r] = -s*M0 + c*M2;
1134 for (
int r = 0; r < 4; ++r) {
1135 const bj_real M0 = m0[r], M1 = m1[r];
1136 o0[r] = c*M0 - s*M1;
1137 o1[r] = s*M0 + c*M1;
1162 if (la <
BJ_F(1.0)) {
1167 if (lb <
BJ_F(1.0)) {
1215 const bj_real det = s[0]*c[5] - s[1]*c[4] + s[2]*c[3]
1216 + s[3]*c[2] - s[4]*c[1] + s[5]*c[0];
1280 (s[0]*c[5] - s[1]*c[4] + s[2]*c[3] + s[3]*c[2] - s[4]*c[1] + s[5]*c[0]);
1340 out->m[
BJ_M4(0,0)] = x.
x;
1341 out->m[
BJ_M4(0,1)] = x.
y;
1342 out->m[
BJ_M4(0,2)] = x.
z;
1343 out->m[
BJ_M4(1,0)] = y.
x;
1344 out->m[
BJ_M4(1,1)] = y.
y;
1345 out->m[
BJ_M4(1,2)] = y.
z;
1346 out->m[
BJ_M4(2,0)] = z.
x;
1347 out->m[
BJ_M4(2,1)] = z.
y;
1348 out->m[
BJ_M4(2,2)] = z.
z;
1380 m[
BJ_M4(2,0)] = (r+l)/(r-l);
1381 m[
BJ_M4(2,1)] = (t+b)/(t-b);
1386 m[
BJ_M4(3,2)] = -(f*n)/(f-n);
1421 m[
BJ_M4(3,0)] = -(r+l)/(r-l);
1422 m[
BJ_M4(3,1)] = (t+b)/(t-b);
1423 m[
BJ_M4(3,2)] = -n/(f-n);
1447 m[
BJ_M4(0,0)] = a/aspect;
1459 m[
BJ_M4(3,2)] = -(f*n)/(f-n);
1492 m[
BJ_M4(2,2)] = (zmax - zmin);
1673 out->m[
BJ_M43(0,0)] = a00 * b00 + a01 * b10 + a02 * b20;
1674 out->m[
BJ_M43(0,1)] = a10 * b00 + a11 * b10 + a12 * b20;
1675 out->m[
BJ_M43(0,2)] = a20 * b00 + a21 * b10 + a22 * b20;
1677 out->m[
BJ_M43(1,0)] = a00 * b01 + a01 * b11 + a02 * b21;
1678 out->m[
BJ_M43(1,1)] = a10 * b01 + a11 * b11 + a12 * b21;
1679 out->m[
BJ_M43(1,2)] = a20 * b01 + a21 * b11 + a22 * b21;
1681 out->m[
BJ_M43(2,0)] = a00 * b20 + a01 * b21 + a02 * b22;
1682 out->m[
BJ_M43(2,1)] = a10 * b20 + a11 * b21 + a12 * b22;
1683 out->m[
BJ_M43(2,2)] = a20 * b20 + a21 * b21 + a22 * b22;
1685 out->m[
BJ_M43(3,0)] = a00 * bt0 + a01 * bt1 + a02 * bt2 + a30;
1686 out->m[
BJ_M43(3,1)] = a10 * bt0 + a11 * bt1 + a12 * bt2 + a31;
1687 out->m[
BJ_M43(3,2)] = a20 * bt0 + a21 * bt1 + a22 * bt2 + a32;
General-purpose definitions for Banjo API.
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:233
#define BJ_INLINE
BJ_INLINE expands to an inline specifier appropriate for the toolchain.
Definition api.h:217
#define BJ_RESTRICT
BJ_RESTRICT expands to the appropriate restrict qualifier per toolchain.
Definition api.h:183
#define BJ_FALSE
Boolean false value (0).
Definition api.h:242
#define BJ_TRUE
Boolean true value (1).
Definition api.h:251
bj_real y
Definition vec.h:40
bj_real m[12]
Definition mat.h:53
bj_real z
Definition vec.h:54
bj_real m[16]
Definition mat.h:43
bj_real m[6]
Definition mat.h:35
bj_real x
Definition vec.h:52
bj_real y
Definition vec.h:28
bj_real y
Definition vec.h:53
bj_real x
Definition vec.h:39
bj_real z
Definition vec.h:41
bj_real x
Definition vec.h:27
bj_real m[9]
Definition mat.h:25
bj_real w
Definition vec.h:55
static void bj_mat3_from_mat3x2(bj_mat3 *restrict M, const bj_mat3x2 *restrict A)
Promote a 3×2 affine matrix to 3×3.
Definition mat.h:624
static void bj_mat3_invert_unsafe(bj_mat3 *restrict out, const bj_mat3 *restrict A)
Invert a 3×3 matrix (unsafe, adjugate).
Definition mat.h:400
static void bj_mat3_set_rotation_z(bj_mat3 *restrict M, bj_real angle)
Matrix operation.
Definition mat.h:316
struct bj_vec3_t bj_vec3
Definition vec.h:43
struct bj_mat3x3_t bj_mat3x3
Definition mat.h:26
#define BJ_M43(c, r)
Definition mat.h:55
static bj_vec3 bj_mat4x3_transform_dir(const bj_mat4x3 *restrict M, bj_vec3 v)
Transform a direction vector (ignoring translation).
Definition mat.h:1716
static bj_vec3 bj_vec3_sub(bj_vec3 lhs, bj_vec3 rhs)
Component-wise subtraction of two 3D vectors: res = lhs - rhs.
Definition vec.h:303
static bj_real bj_vec2_len(bj_vec2 v)
Euclidean length (L2 norm) of a 2D vector.
Definition vec.h:154
static bj_vec4 bj_mat4_col(const bj_mat4 *restrict M, int c)
Extract a matrix column as a vector.
Definition mat.h:725
static void bj_mat3_mul_scalar(bj_mat3 *restrict out, const bj_mat3 *restrict A, bj_real k)
Scalar multiply: out = A * k.
Definition mat.h:166
static void bj_mat4_add(bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
Component-wise addition: out = A + B.
Definition mat.h:765
static void bj_mat3_set_shear_xy(bj_mat3 *restrict M, bj_real shx, bj_real shy)
Build an XY shear into a 3×3 matrix.
Definition mat.h:301
static void bj_mat3_set_translation(bj_mat3 *restrict M, bj_real tx, bj_real ty)
Build a 3×3 translation matrix.
Definition mat.h:250
static void bj_mat4x3_set_identity(bj_mat4x3 *restrict M)
Set a 4×3 affine matrix to identity.
Definition mat.h:1535
static bj_vec3 bj_mat3_row(const bj_mat3 *restrict M, int r)
Extract a matrix row as a vector.
Definition mat.h:88
static void bj_mat4_sub(bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
Component-wise subtraction: out = A - B.
Definition mat.h:782
#define BJ_M32(c, r)
Definition mat.h:37
static void bj_mat4_set_lookat(bj_mat4 *restrict M, bj_vec3 eye, bj_vec3 center, bj_vec3 up)
Build a right-handed look-at view matrix.
Definition mat.h:1508
static void bj_mat3_add(bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
Component-wise addition: out = A + B.
Definition mat.h:134
static void bj_mat4_set_outer_product(bj_mat4 *restrict out, bj_vec3 a, bj_vec3 b)
Add outer product r += s * v^T to a 4×4 matrix.
Definition mat.h:958
static void bj_mat4x3_set_translation(bj_mat4x3 *restrict M, bj_real tx, bj_real ty, bj_real tz)
Matrix operation.
Definition mat.h:1560
static bj_real bj_vec3_len(bj_vec3 v)
Euclidean length (L2 norm) of a 3D vector.
Definition vec.h:343
#define bj_tan
Tangent.
Definition math.h:223
struct bj_mat4x4_t bj_mat4
Definition mat.h:45
static bj_bool bj_mat3_invert(bj_mat3 *restrict out, const bj_mat3 *restrict A)
Invert a 3×3 matrix (safe, adjugate).
Definition mat.h:363
static void bj_mat3x2_set_scaling_xy(bj_mat3x2 *restrict M, bj_real sx, bj_real sy)
Scalar multiply: M = sx * k.
Definition mat.h:514
struct bj_mat4x3_t bj_mat4x3
Definition mat.h:54
static void bj_mat4_orthonormalize(bj_mat4 *restrict out, const bj_mat4 *restrict A)
Orthonormalize the 3×3 linear part of a 4×4 matrix.
Definition mat.h:1311
static void bj_mat4_rotate_y(bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
Right-multiply by a Y-axis rotation.
Definition mat.h:1083
#define BJ_M3(c, r)
Definition mat.h:28
static void bj_mat4_scale_axes(bj_mat4 *restrict out, const bj_mat4 *restrict A, bj_real sx, bj_real sy, bj_real sz)
Scale basis vectors of a 4×4 matrix by per-axis factors.
Definition mat.h:818
static void bj_mat4_rotate_z(bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
Right-multiply by a Z-axis rotation.
Definition mat.h:1116
static void bj_mat3_set_ortho(bj_mat3 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t)
Build a 2D orthographic projection into a 3×3 matrix.
Definition mat.h:430
static void bj_mat4_rotate_x(bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
Right-multiply by an X-axis rotation.
Definition mat.h:1049
struct bj_mat3x3_t bj_mat3
Definition mat.h:27
struct bj_vec2_t bj_vec2
Definition vec.h:30
static bj_vec4 bj_mat4_transform_vec4(const bj_mat4 *restrict M, bj_vec4 v)
Multiply a 4×4 matrix by a 4D vector: r = M * v.
Definition mat.h:895
struct bj_vec4_t bj_vec4
Definition vec.h:57
static bj_vec3 bj_mat4x3_transform_point(const bj_mat4x3 *restrict M, bj_vec3 p)
Transform a 3D point by a 4×3 affine matrix.
Definition mat.h:1697
#define bj_acos
Arc cosine.
Definition math.h:209
static void bj_mat3_transpose(bj_mat3 *restrict out, const bj_mat3 *restrict A)
Transpose a matrix.
Definition mat.h:111
static void bj_mat4x3_set_rotation_y(bj_mat4x3 *restrict M, bj_real a)
Right-multiply by a Y-axis rotation.
Definition mat.h:1611
static void bj_mat3x2_set_identity(bj_mat3x2 *restrict M)
Set a 3×2 affine matrix to identity.
Definition mat.h:480
static bj_vec2 bj_mat3_transform_point(const bj_mat3 *restrict M, bj_vec2 p)
Transform a 2D point by a 3×3 homogeneous transform.
Definition mat.h:228
static void bj_mat4_set_perspective(bj_mat4 *restrict M, bj_real y_fov, bj_real aspect, bj_real n, bj_real f)
Build a 4×4 perspective projection from vertical FOV.
Definition mat.h:1437
static bj_real bj_vec4_dot(bj_vec4 a, bj_vec4 b)
Dot product of two 4D vectors.
Definition vec.h:560
static void bj_mat4_set_frustum(bj_mat4 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
Build a perspective frustum into a 4×4 matrix.
Definition mat.h:1362
static void bj_mat3x2_set_rotation_z(bj_mat3x2 *restrict M, bj_real angle)
Matrix operation.
Definition mat.h:529
#define bj_sin
Sine.
Definition math.h:221
static void bj_mat4_mul_scalar(bj_mat4 *restrict out, const bj_mat4 *restrict A, bj_real k)
Scalar multiply: out = A * k.
Definition mat.h:799
static void bj_mat3x2_set_translation(bj_mat3x2 *restrict M, bj_real tx, bj_real ty)
Matrix operation.
Definition mat.h:498
static void bj_mat3_set_identity(bj_mat3 *restrict M)
Set a 3×3 matrix to identity.
Definition mat.h:61
static void bj_mat4_set_translation(bj_mat4 *restrict M, bj_real x, bj_real y, bj_real z)
Build a 4×4 translation matrix.
Definition mat.h:919
static void bj_mat3_mul(bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
Matrix product: out = A * B.
Definition mat.h:183
static bj_vec2 bj_mat3x2_transform_point(const bj_mat3x2 *restrict M, bj_vec2 p)
Transform a 2D point by a 3×2 affine matrix.
Definition mat.h:586
static void bj_mat3x2_from_mat3(bj_mat3x2 *restrict M, const bj_mat3 *restrict A)
Demote a 3×3 matrix to 3×2 (drop projective terms).
Definition mat.h:646
static bj_vec3 bj_vec3_normalize(bj_vec3 v)
Normalize a 3D vector to unit length (safe).
Definition vec.h:397
static void bj_mat4_translate(bj_mat4 *restrict M, bj_real x, bj_real y, bj_real z)
Right-multiply by a translation: M = M * T(tx,ty,tz).
Definition mat.h:939
#define BJ_FZERO
Zero constant in bj_real.
Definition math.h:64
static void bj_mat3_set_viewport(bj_mat3 *restrict M, bj_real x, bj_real y, bj_real w, bj_real h)
Build a 2D viewport transform into a 3×3 matrix.
Definition mat.h:457
static void bj_mat4_mul(bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
Matrix product: out = A * B.
Definition mat.h:853
static void bj_mat4_set_ortho(bj_mat4 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
Build a 3D orthographic projection into a 4×4 matrix.
Definition mat.h:1401
static bj_vec4 bj_mat4_row(const bj_mat4 *restrict M, int r)
Extract a matrix row as a vector.
Definition mat.h:706
static void bj_mat4_rotate_axis_andle(bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_vec3 axis, bj_real angle)
Right-multiply a 4×4 by a rotation around an arbitrary axis.
Definition mat.h:989
static void bj_mat3_translate(bj_mat3 *restrict M, bj_real tx, bj_real ty)
Right-multiply by a translation: M = M * T(tx,ty).
Definition mat.h:267
static bj_vec2 bj_vec2_normalize(bj_vec2 v)
Normalize a 2D vector to unit length (safe).
Definition vec.h:208
static int bj_real_is_zero(bj_real x)
Absolute-zero test.
Definition math.h:441
static void bj_mat4_invert_unsafe(bj_mat4 *restrict out, const bj_mat4 *restrict M)
Invert a 4×4 matrix (unsafe).
Definition mat.h:1258
static bj_real bj_vec2_dot(bj_vec2 a, bj_vec2 b)
Dot product of two 2D vectors.
Definition vec.h:137
static bj_vec3 bj_vec3_cross(bj_vec3 l, bj_vec3 r)
3D cross product: res = l × r (right-hand rule).
Definition vec.h:453
struct bj_mat3x2_t bj_mat3x2
Definition mat.h:36
struct bj_mat4x4_t bj_mat4x4
Definition mat.h:44
static bj_vec2 bj_mat3x2_transform_dir(const bj_mat3x2 *restrict M, bj_vec2 v)
Transform a direction vector (ignoring translation).
Definition mat.h:606
static bj_vec3 bj_mat3_col(const bj_mat3 *restrict M, int c)
Extract a matrix column as a vector.
Definition mat.h:101
static bj_vec3 bj_mat3_transform_vec3(const bj_mat3 *restrict M, bj_vec3 v)
Multiply a 3×3 matrix by a 3D vector: r = M * v.
Definition mat.h:209
#define bj_cos
Cosine.
Definition math.h:212
static void bj_mat4_set_viewport(bj_mat4 *restrict M, bj_real x, bj_real y, bj_real w, bj_real h)
Build a 3D viewport transform into a 4×4 matrix.
Definition mat.h:1472
static bj_real bj_vec3_dot(bj_vec3 a, bj_vec3 b)
Dot product of two 3D vectors.
Definition vec.h:334
static void bj_mat4_copy(bj_mat4 *restrict dst, const bj_mat4 *restrict src)
Copy a matrix.
Definition mat.h:691
static void bj_mat4x3_mul(bj_mat4x3 *restrict out, const bj_mat4x3 *restrict A, const bj_mat4x3 *restrict B)
Matrix product: out = A * B.
Definition mat.h:1643
static void bj_mat4_from_mat4x3(bj_mat4 *restrict M, const bj_mat4x3 *restrict A)
Promote a 4×3 affine matrix to 4×4.
Definition mat.h:1733
static void bj_mat4_set_identity(bj_mat4 *restrict M)
Set a 4×4 matrix to identity.
Definition mat.h:664
static bj_real bj_mat3_determinant(const bj_mat3 *restrict A)
Determinant of a 3×3 matrix.
Definition mat.h:339
#define BJ_F(x)
Literal suffix helper for bj_real when float is selected.
Definition math.h:53
static bj_bool bj_mat4_invert(bj_mat4 *restrict out, const bj_mat4 *restrict M)
Invert a 4×4 matrix (safe).
Definition mat.h:1194
static void bj_mat4x3_set_scaling_xyz(bj_mat4x3 *restrict M, bj_real sx, bj_real sy, bj_real sz)
Scalar multiply: M = sx * k.
Definition mat.h:1579
static void bj_mat3x2_mul(bj_mat3x2 *restrict out, const bj_mat3x2 *restrict A, const bj_mat3x2 *restrict B)
Matrix product: out = A * B.
Definition mat.h:551
static void bj_mat3_set_scaling_xy(bj_mat3 *restrict M, bj_real sx, bj_real sy)
Apply non-uniform XY scale to a 3×3 matrix.
Definition mat.h:285
static void bj_mat4_rotate_arcball(bj_mat4 *restrict R, const bj_mat4 *restrict M, bj_vec2 a, bj_vec2 b, bj_real s)
Build a 4×4 rotation from two unit vectors (arcball).
Definition mat.h:1151
static void bj_mat3_sub(bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
Component-wise subtraction: out = A - B.
Definition mat.h:150
#define bj_sqrt
Square root.
Definition math.h:222
float bj_real
Selected real type for float configuration.
Definition math.h:51
static void bj_mat4_transpose(bj_mat4 *restrict out, const bj_mat4 *restrict A)
Transpose a matrix.
Definition mat.h:743
#define BJ_M4(c, r)
Definition mat.h:46
static bj_vec3 bj_vec3_scale(bj_vec3 v, bj_real s)
Uniform scaling by scalar: res = v * s.
Definition vec.h:320
static void bj_mat4x3_set_rotation_z(bj_mat4x3 *restrict M, bj_real a)
Right-multiply by a Z-axis rotation.
Definition mat.h:1626
static void bj_mat3_copy(bj_mat3 *restrict dst, const bj_mat3 *restrict src)
Copy a matrix.
Definition mat.h:73
static void bj_mat4x3_from_mat4(bj_mat4x3 *restrict M, const bj_mat4 *restrict A)
Demote a 4×4 matrix to 4×3 (drop projective terms).
Definition mat.h:1761
static void bj_mat4x3_set_rotation_x(bj_mat4x3 *restrict M, bj_real a)
Right-multiply by an X-axis rotation.
Definition mat.h:1596
bj_mat3x2: 3×2 column-major matrix backed by bj_vec2.
Definition mat.h:35
bj_mat4x3: 4×3 column-major matrix backed by bj_vec3.
Definition mat.h:53
bj_mat4x4: 4×4 column-major matrix backed by bj_vec4.
Definition mat.h:43
C99 math shim with bj_real precision type and scalar utilities.