Finish out final mat3 functions. Revert to .h library

This commit is contained in:
Alex Selimov 2026-10-28 23:30:31 -04:00
parent 7e5de6f6eb
commit 139444ccc6
3 changed files with 48 additions and 29 deletions

View file

@ -135,6 +135,19 @@ int test_mat3_inv() {
return mat3_eql_tol(inv_a, expected_inv, 1e-11);
}
int test_mat3_mul_vec3() {
struct Mat3 a = {
{0.0, 1.0, 0.0},
{0.0, 1.0, 1.0},
{0.0, 0.0, 1.0},
};
struct Vec3 b = {1.0, 2.0, 3.0};
struct Vec3 expected_c = {2.0, 5.0, 3.0};
return vec3_eql_tol(expected_c, mat3_mul_vec(a, b), 1e-12);
}
int main() {
int tests_total = 0;
int tests_passed = 0;
@ -152,6 +165,7 @@ int main() {
run_test(test_mat3_mul);
run_test(test_mat3_det);
run_test(test_mat3_inv);
run_test(test_mat3_mul_vec3);
if (tests_total == tests_passed) {
printf("\033[92mAll tests passed!\033[0m");