-
Notifications
You must be signed in to change notification settings - Fork 1
/
matrices.h
38 lines (27 loc) · 927 Bytes
/
matrices.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* matrices.h - Matrix implementation
*
* Copyright (c) 2023, Dimitrios Alexopoulos All rights reserved.
*/
#ifndef MATRICES_H
#define MATRICES_H
#include <stdbool.h>
#include <stddef.h>
#include "tuples.h"
#define MAT_EPSILON 0.00001
typedef double Mat2[2][2];
typedef double Mat3[3][3];
typedef double Mat4[4][4];
bool mat2Eq(const Mat2 a, const Mat2 b);
bool mat3Eq(const Mat3 a, const Mat3 b);
bool mat4Eq(const Mat4 a, const Mat4 b);
void mat2Mul(Mat2 dest, const Mat2 a, const Mat2 b);
void mat4Mul(Mat4 dest, const Mat4 a, const Mat4 b);
Tuple mat4VecMul(const Mat4 mat, const Tuple vec);
void mat4Trans(Mat4 dest, const Mat4 a);
double mat2Det(const Mat2 a);
void mat3SubM(Mat2 dest, size_t row, size_t col, const Mat3 a);
void mat4SubM(Mat3 dest, size_t row, size_t col, const Mat4 a);
double mat3Min(size_t row, size_t col, const Mat3 a);
double mat3Cof(size_t row, size_t col, const Mat3 a);
#endif