2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
65
66
67
68
87
88
89
92
93
94
95
96
97
101
102
103
104
105
109
110
111
115
116
117
121
122
123
127
128
129
133
134
135
139
140
141
145
146
147
151
152
153
157
158
159
163
164
165
169
170
171
175
176
177
181
182
183
187
188
189
193
194
195
199
200
201
205
206
207
211
212
213
214
215
216
217
221
222
223
227
228
229
233
234
235
239
240
241
245
246
247
251
252
253
254SHZ_INLINE
void shz_mat4x4_init_ortho(shz_mat4x4_t* mat,
float left,
float right,
float bottom,
float top,
float znear,
float zfar) SHZ_NOEXCEPT;
257
258
259
260SHZ_INLINE
void shz_mat4x4_init_frustum(shz_mat4x4_t* mat,
float left,
float right,
float bottom,
float top,
float znear,
float zfar) SHZ_NOEXCEPT;
263
264
265
272
273
274
277
278
279
280
282 shz_vec3_t* translation,
283 shz_quat_t* rotation,
284 shz_vec3_t* scale) SHZ_NOEXCEPT;
289
290
291
294SHZ_INLINE shz_vec4_t
shz_mat4x4_row(
const shz_mat4x4_t* mat, size_t row) SHZ_NOEXCEPT;
297SHZ_INLINE shz_vec4_t
shz_mat4x4_col(
const shz_mat4x4_t* mat, size_t col) SHZ_NOEXCEPT;
309SHZ_INLINE
void shz_mat4x4_3x3(
const shz_mat4x4_t* mat4, shz_mat3x3_t* mat3) SHZ_NOEXCEPT;
323
324
325
354
355
356
359
360
361
365
366
367
371
372
373
377
378
379
383
384
385
389
390
391
395
396
397
401
402
403
407
408
409
413
414
415
416
417
421
422
423
424
425
429
430
431
432
433
437
438
439
440
441
445
446
447
448
449
453
454
455
459
460
461
465
466
467
468SHZ_INLINE
void shz_mat4x4_apply_ortho(shz_mat4x4_t* m,
float left,
float right,
float bottom,
float top,
float znear,
float zfar) SHZ_NOEXCEPT;
471
472
473
474SHZ_INLINE
void shz_mat4x4_apply_frustum(shz_mat4x4_t* m,
float left,
float right,
float bottom,
float top,
float znear,
float zfar) SHZ_NOEXCEPT;
477
478
479
483
484
485
489
490
491
495
496
497
501
502
503
507
508
509
515
516
517
520
521
522
523
527
528
529
530
531SHZ_INLINE
void shz_mat4x4_scale(shz_mat4x4_t* mat,
float x,
float y,
float z) SHZ_NOEXCEPT;
534
535
536
540
541
542
546
547
548
552
553
554
555SHZ_INLINE
void shz_mat4x4_rotate_xyz(shz_mat4x4_t* mat,
float xRadians,
float yRadians,
float zRadians) SHZ_NOEXCEPT;
558
559
560
561SHZ_INLINE
void shz_mat4x4_rotate_zyx(shz_mat4x4_t* mat,
float zRadians,
float yRadians,
float xRadians) SHZ_NOEXCEPT;
564
565
566
567SHZ_INLINE
void shz_mat4x4_rotate_zxy(shz_mat4x4_t* mat,
float zRadians,
float xRadians,
float yRadians) SHZ_NOEXCEPT;
570
571
572
573SHZ_INLINE
void shz_mat4x4_rotate_yxz(shz_mat4x4_t* mat,
float yRadians,
float xRadians,
float zRadians) SHZ_NOEXCEPT;
576
577
578
579
580SHZ_INLINE
void shz_mat4x4_rotate(shz_mat4x4_t* mat,
float radians,
float xAxis,
float yAxis,
float zAxis) SHZ_NOEXCEPT;
585
586
587
590
591
592
593SHZ_INLINE
void shz_mat4x4_mult(shz_mat4x4_t* mat,
const shz_mat4x4_t* lhs,
const shz_mat4x4_t* rhs) SHZ_NOEXCEPT;
596
597
598
602
603
604
608
609
610
614
615
616
617
618
619
620
621
622
623
624
628
629
630
631
632
633
634
635
636
637
638
642
643
644
645
646
647
648
649
650
651
652
656
657
658
659
660
661
662
663
664
665
666
667
671
672
673
674
675
676
677
678
679
680
681
682
686
687
688
689
690
691
692
693
694
695
696
697
701
702
703
704
705
706
707
708
709
710
711
715
716
717
718
719
720
721
722
723
724
725
729
730
731
732
733
734
735
736
737
738
739
740
744
745
746
747
748
749
750
751
752
753
754
755
761
762
763
769
770
771
775
776
777
778
779
780
781
782
783
784void shz_mat4x4_inverse(
const shz_mat4x4_t* SHZ_RESTRICT mtrx, shz_mat4x4_t* SHZ_RESTRICT out) SHZ_NOEXCEPT;
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
807SHZ_INLINE
bool shz_mat4x4_equal(
const shz_mat4x4_t* SHZ_RESTRICT mat1,
const shz_mat4x4_t* mat2) SHZ_NOEXCEPT;
813SHZ_INLINE
void shz_mat4x4_copy(shz_mat4x4_t* dst,
const shz_mat4x4_t* src) SHZ_NOEXCEPT;
816
817
818
822
823
824
831typedef SHZ_ALIGNAS(8)
struct shz_mat2x2 {
839typedef struct shz_mat3x3 {
852typedef struct shz_mat3x4 {
866typedef struct shz_mat4x3 {
880
881
882
883
884
885
886
887
888SHZ_INLINE
void shz_mat3x3_transpose(
const shz_mat3x3_t* mat, shz_mat3x3_t* out) SHZ_NOEXCEPT;
891
892
893
894
895
896
897
898
899
900
901
902
903SHZ_INLINE
void shz_mat3x3_inverse_unscaled(
const shz_mat3x3_t* mtrx, shz_mat3x3_t* out) SHZ_NOEXCEPT;
906
907
908
909
910
911
912
913
914
915
916SHZ_INLINE
void shz_mat3x3_inverse(
const shz_mat3x3_t* mtrx, shz_mat3x3_t* out) SHZ_NOEXCEPT;
918SHZ_INLINE
void shz_mat3x3_scale(shz_mat3x3_t* dst,
const shz_mat3x3_t* src,
float value) SHZ_NOEXCEPT;
919SHZ_INLINE shz_vec3_t shz_mat3x3_transform_vec3(
const shz_mat3x3_t* m, shz_vec3_t v) SHZ_NOEXCEPT;
920SHZ_INLINE shz_vec3_t shz_mat3x3_transform_vec3_transpose(
const shz_mat3x3_t* m, shz_vec3_t v) SHZ_NOEXCEPT;
924#include "inline/shz_matrix.inl.h"
bool shz_mat4x4_is_block_triangular(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Returns true if the given matrix is in block-triangular form: having a bottom row in the form of <0....
void shz_mat4x4_apply_rotation_y(shz_mat4x4_t *mat, float yAngle) SHZ_NOEXCEPT
Multiplies and accumulates a rotation matrix by yAngle radians about the Y-axis onto the given matrix...
void shz_mat4x4_scale(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates mat by a 3D scaling matrix with the given components.
void shz_mat4x4_init_lower_triangular(shz_mat4x4_t *mat, shz_vec4_t col1, shz_vec3_t col2, shz_vec2_t col3, float col4) SHZ_NOEXCEPT
Initializes the given matrix to a lower triangular matrix whose nonzero entries have the given value.
void shz_mat4x4_init_rotation_z(shz_mat4x4_t *mat, float zAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix by zAngle radians over the Z-axis.
void shz_mat4x4_set_diagonal(shz_mat4x4_t *mat, float x, float y, float z, float w) SHZ_NOEXCEPT
Assigns only the 4 elements along the diagonal of the given matrix to the given values.
void shz_mat4x4_transpose(const shz_mat4x4_t *mat, shz_mat4x4_t *out) SHZ_NOEXCEPT
Stores the transpose of mat within out.
void shz_mat4x4_init_rotation_zxy(shz_mat4x4_t *mat, float zAngle, float xAngle, float yAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given...
void shz_mat4x4_apply_permutation_yzwx(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors...
void shz_mat4x4_init_frustum(shz_mat4x4_t *mat, float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Initializes the given matrix to a frustum projection matrix.
void shz_mat4x4_decompose(const shz_mat4x4_t *mat, shz_vec3_t *translation, shz_quat_t *rotation, shz_vec3_t *scale) SHZ_NOEXCEPT
Decomposes a 4x4 transform matrix into translation, rotation, and scale.
shz_vec3_t shz_mat4x4_transform_point3(const shz_mat4x4_t *mat, shz_vec3_t pt) SHZ_NOEXCEPT
Transforms a 3D point by a 4x4 matrix.
void shz_mat4x4_mult_transpose_unaligned(shz_mat4x4_t *mat, const shz_mat4x4_t *lhs, const float rhs[16]) SHZ_NOEXCEPT
Multiplies the regular matrix, lhs, by the transpose of the unaligned matrix, rhs,...
void shz_mat4x4_copy_unaligned(shz_mat4x4_t *dst, const float src[16]) SHZ_NOEXCEPT
Copies the given unaligned src 4x4 matrix into the given dst 4x4 matrix.
void shz_mat4x4_rotate_y(shz_mat4x4_t *mat, float radians) SHZ_NOEXCEPT
Multiplies and accumulates mat by a 3D rotation matrix about the Y axis.
void shz_mat4x4_mult_transpose(shz_mat4x4_t *mat, const shz_mat4x4_t *lhs, const shz_mat4x4_t *rhs) SHZ_NOEXCEPT
Multiplies the regular matrix, lhs, by the transpose of the matrix, rhs, storing the result into mat.
void shz_mat4x4_mult(shz_mat4x4_t *mat, const shz_mat4x4_t *lhs, const shz_mat4x4_t *rhs) SHZ_NOEXCEPT
Multiplies two 4x4 matrices together, storing the result into a third.
void shz_mat4x4_apply_transpose(shz_mat4x4_t *dst, const shz_mat4x4_t *src) SHZ_NOEXCEPT
Multiplies and accumulates the transposed src 4x4 matrix onto the dst 4x4 matrix.
void shz_mat4x4_apply_transpose_unaligned(shz_mat4x4_t *dst, const float src[16]) SHZ_NOEXCEPT
Multiplies and accumulates the transposed unaligned src 4x4 matrix onto the dst 4x4 matrix.
void shz_mat4x4_init_identity(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the given matrix to the identity matrix as fast as possible.
void shz_mat4x4_init_rotation(shz_mat4x4_t *mat, float radians, float xAxis, float yAxis, float zAxis) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix about the given axis rotated by angle radians.
void shz_mat4x4_3x3_inverse_unscaled(const shz_mat4x4_t *mat4, shz_mat3x3_t *invmat3) SHZ_NOEXCEPT
Extracts and inverts the top-level, unscaled 3x3 of the given 4x4 matrix.
float shz_mat4x4_3x3_determinant(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Returns the determinant of the given 4x4 matrix's internal top-level 3x3 matrix.
void shz_mat4x4_init_permutation_wxyz(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the matrix to to a permutation matrix, which reorders the components of transformed vecto...
void shz_mat4x4_init_rotation_xyz(shz_mat4x4_t *mat, float xAngle, float yAngle, float zAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given...
void shz_mat4x4_apply_perspective(shz_mat4x4_t *m, float fov, float aspect, float znear) SHZ_NOEXCEPT
Multiplies and accumulates the perspective matrix constructed from the given values onto the given ma...
void shz_mat4x4_apply_rotation_quat(shz_mat4x4_t *m, shz_quat_t q) SHZ_NOEXCEPT
Multiplies and accumulates the given matrix with a rotation matrix whose orientation is given by a qu...
void shz_mat4x4_init_rotation_y(shz_mat4x4_t *mat, float yAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix by yAngle radians over the Y-axis.
void shz_mat4x4_init_zero(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the given matrix with all 0s for its element values.
shz_vec2_t shz_mat4x4_transform_point2(const shz_mat4x4_t *mat, shz_vec2_t pt) SHZ_NOEXCEPT
Transforms a 2D point by a 4x4 matrix.
void shz_mat4x4_swap_rows(shz_mat4x4_t *mat, size_t row1, size_t row2) SHZ_NOEXCEPT
Swaps the 4D row vectors located at row1 and row2 within mat.
float shz_mat4x4_determinant(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Returns the determinant of the given 4x4 matrix.
shz_vec3_t shz_mat4x4_transform_point3_transpose(const shz_mat4x4_t *mat, shz_vec3_t pt) SHZ_NOEXCEPT
Transforms a 3D point by the transpose of a 4x4 matrix.
void shz_mat4x4_init_outer_product(shz_mat4x4_t *mat, shz_vec4_t v1, shz_vec4_t v2) SHZ_NOEXCEPT
Initializes the given matrix to be the result from taking the outer product of the two given 4D vecto...
void shz_mat4x4_apply_screen(shz_mat4x4_t *m, float width, float height) SHZ_NOEXCEPT
Multiplies and accumulates the viewport matrix created with the given components ont othe given matri...
shz_vec2_t shz_mat4x4_transform_vec2(const shz_mat4x4_t *m, shz_vec2_t v) SHZ_NOEXCEPT
Transforms a 2D vector by a 4x4 matrix.
void shz_mat4x4_3x3_inverse(const shz_mat4x4_t *mat4, shz_mat3x3_t *invmat3) SHZ_NOEXCEPT
Extracts and inverts the top-level 3x3 (which may be scaled) of the given 4x4 matrix.
shz_vec2_t shz_mat4x4_transform_point2_transpose(const shz_mat4x4_t *mat, shz_vec2_t pt) SHZ_NOEXCEPT
Transforms a 2D point by the transpose of a 4x4 matrix.
void shz_mat4x4_init_rotation_x(shz_mat4x4_t *mat, float xAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix by xAngle radians over the X-axis.
float shz_mat4x4_trace(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Returns the trace of the given 4x4 matrix.
void shz_mat4x4_apply_rotation_zxy(shz_mat4x4_t *mat, float zAngle, float xAngle, float yAngle) SHZ_NOEXCEPT
Rotates the given transform matrix about the Z axis, then the X axis, then the Y axis by the given an...
void shz_mat4x4_apply_symmetric_skew(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates the given matrix with a symmetric skew matrix formed from the given 3D vec...
void shz_mat4x4_apply_self(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Multiplies and accumulates the given matrix onto itself.
void shz_mat4x4_init_scale(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Initializes the given matrix to a 3D scaling matrix with the given dimensions.
void shz_mat4x4_init_identity_safe(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the given matrix to the identity matrix, safely zeroing out NaN values.
void shz_mat4x4_init_ortho(shz_mat4x4_t *mat, float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Initializes the given matrix to an orthographic projection matrix.
void shz_mat4x4_apply_rotation_xyz(shz_mat4x4_t *mat, float xAngle, float yAngle, float zAngle) SHZ_NOEXCEPT
Rotates the given transform matrix about the X axis, then the Y axis, then the Z axis by the given an...
void shz_mat4x4_translate(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates mat by a 3D translation matrix with the given components.
shz_vec4_t shz_mat4x4_col(const shz_mat4x4_t *mat, size_t col) SHZ_NOEXCEPT
Extracts the col index as a 4D column vector from the given matrix.
void shz_mat4x4_apply_permutation_wxyz(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors...
void shz_mat4x4_rotate(shz_mat4x4_t *mat, float radians, float xAxis, float yAxis, float zAxis) SHZ_NOEXCEPT
Multiplies and accumulates mat by the 3D rotation matrix formed by the given axis and angle.
void shz_mat4x4_apply_rotation_yxz(shz_mat4x4_t *mat, float yAngle, float xAngle, float zAngle) SHZ_NOEXCEPT
Rotates the given transform matrix about the Y axis, then the X axis, then the Z axis by the given an...
void shz_mat4x4_set_translation(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Assigns only the 3D translation-related elements of the given matrix to the given values.
void shz_mat4x4_init_perspective(shz_mat4x4_t *mat, float fov, float aspect, float znear) SHZ_NOEXCEPT
Initializes the given matrix to a perspective projection matrix.
void shz_mat4x4_rotate_xyz(shz_mat4x4_t *mat, float xRadians, float yRadians, float zRadians) SHZ_NOEXCEPT
Multiplies and accumulates mat by 3D rotation matrices about the X then Y then Z axes.
void shz_mat4x4_init_upper_triangular(shz_mat4x4_t *mat, float col1, shz_vec2_t col2, shz_vec3_t col3, shz_vec4_t col4) SHZ_NOEXCEPT
Initializes the given matrix to an upper triangular matrix whose nonzero entries have the given value...
void shz_mat4x4_apply_frustum(shz_mat4x4_t *m, float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Multiplies and accumulates the frustum matrix constructed from the given values onto the given matrix...
void shz_mat4x4_rotate_yxz(shz_mat4x4_t *mat, float yRadians, float xRadians, float zRadians) SHZ_NOEXCEPT
Multiplies and accumulates mat by 3D rotation matrices about the Y then X then Z axes.
shz_quat_t shz_mat4x4_to_quat(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Converts the given 4x4 orientation matrix into a quaternion.
void shz_mat4x4_apply(shz_mat4x4_t *dst, const shz_mat4x4_t *src) SHZ_NOEXCEPT
Multiplies and accumulates the src 4x4 matrix onto the dst 4x4 matrix.
void shz_mat4x4_rotate_zxy(shz_mat4x4_t *mat, float zRadians, float xRadians, float yRadians) SHZ_NOEXCEPT
Multiplies and accumulates mat by 3D rotation matrices about the Z then X then Y axes.
shz_vec3_t shz_mat4x4_transform_vec3_transpose(const shz_mat4x4_t *m, shz_vec3_t v) SHZ_NOEXCEPT
Transforms a 3D vector the the transpose of a 4x4 matrix.
shz_vec4_t shz_mat4x4_transform_vec4(const shz_mat4x4_t *mat, shz_vec4_t in) SHZ_NOEXCEPT
Transforms a 4D vector by a 4x4 matrix.
void shz_mat4x4_swap_cols(shz_mat4x4_t *mat, size_t col1, size_t col2) SHZ_NOEXCEPT
Swaps the 4D column vectors located at col1 and col2 within mat.
void shz_mat4x4_init_translation(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Initializes the given matrix to a 3D translation matrix with the given coordinates.
void shz_mat4x4_apply_rotation_zyx(shz_mat4x4_t *mat, float zAngle, float yAngle, float xAngle) SHZ_NOEXCEPT
Rotates the given transform matrix about the Z axis, then the Y axis, then the X axis by the given an...
void shz_mat4x4_copy(shz_mat4x4_t *dst, const shz_mat4x4_t *src) SHZ_NOEXCEPT
Copies the given src 4x4 matrix into the given dst 4x4 matrix.
void shz_mat4x4_rotate_z(shz_mat4x4_t *mat, float radians) SHZ_NOEXCEPT
Multiplies and accumulates mat by a 3D rotation matrix about the Z axis.
void shz_mat4x4_apply_rotation_z(shz_mat4x4_t *mat, float zAngle) SHZ_NOEXCEPT
Multiplies and accumulates a rotation matrix by zAngle radians about the Z-axis onto the given matrix...
void shz_mat4x4_set_scale(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Assigns only the 3D scale-related elements of the given matrix to the given values.
void shz_mat4x4_apply_scale(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates the scale-related elements of the given matrix by the given 3D components.
void shz_mat4x4_set_rotation_quat(shz_mat4x4_t *m, shz_quat_t q) SHZ_NOEXCEPT
Sets just the rotational component of the matrix to the orientation given by a quaternion,...
shz_vec2_t shz_mat4x4_transform_vec2_transpose(const shz_mat4x4_t *m, shz_vec2_t v) SHZ_NOEXCEPT
Transforms a 2D vector the the transpose of a 4x4 matrix.
void shz_mat4x4_apply_translation(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Adds the given 3D vector components to the translational values of the given matrix.
void shz_mat4x4_rotate_zyx(shz_mat4x4_t *mat, float zRadians, float yRadians, float xRadians) SHZ_NOEXCEPT
Multiplies and accumulates mat by 3D rotation matrices about the Z then Y then X axes.
void shz_mat4x4_set_row(shz_mat4x4_t *mat, size_t row, shz_vec4_t vec) SHZ_NOEXCEPT
Sets the values of mat at the given row to those of the 4D vector, vec.
void shz_mat4x4_mult_unaligned(shz_mat4x4_t *mat, const shz_mat4x4_t *lhs, const float rhs[16]) SHZ_NOEXCEPT
Multiplies two 4x4 matrices together, with the right handed matrix being unaligned,...
void shz_mat4x4_rotate_x(shz_mat4x4_t *mat, float radians) SHZ_NOEXCEPT
Multiplies and accumulates mat by a 3D rotation matrix about the X axis.
void shz_mat4x4_init_symmetric_skew(shz_mat4x4_t *mat, float x, float y, float z) SHZ_NOEXCEPT
Initializes the given matrix to be the symmetric skew of the given 3D vector components.
void shz_mat4x4_init_lookat(shz_mat4x4_t *mat, shz_vec3_t eye, shz_vec3_t center, shz_vec3_t up) SHZ_NOEXCEPT
Initializes the given matrix to a "lookAt" view matrix.
void shz_mat4x4_init_rotation_yxz(shz_mat4x4_t *mat, float yAngle, float xAngle, float zAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given...
void shz_mat4x4_init_diagonal(shz_mat4x4_t *mat, float x, float y, float z, float w) SHZ_NOEXCEPT
Initializes the given matrix to a diagonal matrix with the given 4 values.
shz_mat4x4_t shz_mat4x4
Alternate shz_mat4x4_t C typedef for those who hate POSIX style.
void shz_mat4x4_init_rotation_zyx(shz_mat4x4_t *mat, float zAngle, float yAngle, float xAngle) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given...
void shz_mat4x4_init_permutation_yzwx(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the matrix to to a permutation matrix, which reorders the components of transformed vecto...
shz_vec4_t shz_mat4x4_transform_vec4_transpose(const shz_mat4x4_t *m, shz_vec4_t v) SHZ_NOEXCEPT
Transforms a 4D vector the the transpose of a 4x4 matrix.
void shz_mat4x4_swap(shz_mat4x4_t *matA, shz_mat4x4_t *matB) SHZ_NOEXCEPT
Swaps the contents of the two given matrices, matA and matB.
shz_vec3_t shz_mat4x4_get_translation(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Returns the translational components from the 4th column as a 3D vector.
void shz_mat4x4_apply_rotation_x(shz_mat4x4_t *mat, float xAngle) SHZ_NOEXCEPT
Multiplies and accumulates a rotation matrix by xAngle radians about the X-axis onto the given matrix...
void shz_mat4x4_init_fill(shz_mat4x4_t *mat, float value) SHZ_NOEXCEPT
Initializes the given matrix with all elements assigned to the given value.
void shz_mat4x4_apply_unaligned(shz_mat4x4_t *dst, const float src[16]) SHZ_NOEXCEPT
Multiplies and accumulates the unaligned src 4x4 matrix onto the dst 4x4 matrix.
void shz_mat4x4_apply_ortho(shz_mat4x4_t *m, float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Multiplies and accumulates the ortho matrix constructed from the given values onto the given matrix.
void shz_mat4x4_apply_lookat(shz_mat4x4_t *m, shz_vec3_t pos, shz_vec3_t target, shz_vec3_t up) SHZ_NOEXCEPT
Applies the 3D "lookAt" matrix constructed with the given vector components onto the given matrix.
shz_vec4_t shz_mat4x4_row(const shz_mat4x4_t *mat, size_t row) SHZ_NOEXCEPT
Extracts the row index as a 4D row vector from the given matrix.
bool shz_mat4x4_equal(const shz_mat4x4_t *SHZ_RESTRICT mat1, const shz_mat4x4_t *mat2) SHZ_NOEXCEPT
Returns true if the two matrices are equal, based on either absolute or relative tolerance.
shz_vec3_t shz_mat4x4_transform_vec3(const shz_mat4x4_t *m, shz_vec3_t v) SHZ_NOEXCEPT
Transforms a 3D vector by a 4x4 matrix.
void shz_mat4x4_apply_rotation(shz_mat4x4_t *mat, float angle, float xAxis, float yAxis, float zAxis) SHZ_NOEXCEPT
Rotates the given transform matrix about the arbitrary axis given by a 3D direction vector and angle ...
void shz_mat4x4_inverse(const shz_mat4x4_t *SHZ_RESTRICT mtrx, shz_mat4x4_t *SHZ_RESTRICT out) SHZ_NOEXCEPT
Computes the inverse of a 4x4 matrix.
void shz_mat4x4_init_one(shz_mat4x4_t *mat) SHZ_NOEXCEPT
Initializes the given matrix with all 1s for its element values.
void shz_mat4x4_init_rotation_quat(shz_mat4x4_t *m, shz_quat_t q) SHZ_NOEXCEPT
Initializes the given matrix to a 3D rotation matrix with its orientation given by a quaternion.
void shz_mat4x4_3x3(const shz_mat4x4_t *mat4, shz_mat3x3_t *mat3) SHZ_NOEXCEPT
Extracts the top-left 3x3 of the given 4D matrix.
void shz_mat4x4_inverse_block_triangular(const shz_mat4x4_t *mtx, shz_mat4x4_t *out) SHZ_NOEXCEPT
Computes the inverse of a 4x4 matrix in block-triangular form.
void shz_mat4x4_init_screen(shz_mat4x4_t *mat, float width, float height) SHZ_NOEXCEPT
Initializes the given matrix to the viewport matrix with the given dimenions.
void shz_mat4x4_set_col(shz_mat4x4_t *mat, size_t col, shz_vec4_t vec) SHZ_NOEXCEPT
Sets the values of mat at the given col to those of the 4D vector, vec.
Structure representing a 4x4 column-major matrix.
float elem[16]
< Inner convenience union.
shz_vec4_t pos
Access the last column of the matrix as a 1x4 vector.
shz_vec4_t col[4]
Access the matrix as an array of 4 1x4 column vectors.
shz_vec4_t forward
Access the third column of the matrix as a 1x4 vector.
shz_vec4_t left
< Named column vectors.
shz_vec4_t up
Access the second column of the matrix as a 1x4 vector.
float elem2D[4][4]
Access the matrix as a 2D array of 4x4 single-precision floats.