]> git.bts.cx Git - benzene.git/blob - src/bz/math/matrix.h
Sprites
[benzene.git] / src / bz / math / matrix.h
1 #ifndef BZ_MATH_MATRIX_H
2 #define BZ_MATH_MATRIX_H
3
4 #include <bz/math/vector.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 struct BZMatrix {
11 float a;
12 float b;
13 float c;
14 float d;
15 float x;
16 float y;
17 };
18 typedef struct BZMatrix BZMatrix;
19
20
21 extern void bzMatrixSet(BZMatrix *matrixOut, float a, float b, float c, float d, float x, float y);
22 extern void bzMatrixCopy(BZMatrix *matrixOut, const BZMatrix *matrix);
23
24 extern void bzMatrixInverse(BZMatrix *matrixOut, const BZMatrix *matrix);
25 extern void bzMatrixMultiply(BZMatrix *matrixOut, const BZMatrix *matrix1, const BZMatrix *matrix2);
26
27 extern void bzMatrixIdentity(BZMatrix *matrixOut);
28 extern void bzMatrixRotation(BZMatrix *matrixOut, float angle);
29 extern void bzMatrixTranslation(BZMatrix *matrixOut, float translateX, float translateY);
30 extern void bzMatrixScale(BZMatrix *matrixOut, float scaleX, float scaleY);
31 //extern void bzMatrixTRS(BZMatrix *matrixOut, float translateX, float translateY, float angle, float scaleX, float scaleY);
32 extern void bzMatrixSRT(BZMatrix *matrixOut, float translateX, float translateY, float angle, float scaleX, float scaleY);
33 extern void bzMatrixShear(BZMatrix *matrixOut, float shearX, float shearY);
34 extern void bzMatrixOrtho(BZMatrix *matrixOut, float left, float top, float right, float bottom);
35
36 //extern void bzMatrixScaleVector(BZVector *vectorOut, const BZVector *vector, const BZMatrix *matrix); // NB: Expensive
37 extern void bzMatrixTranslateVector(BZVector *vectorOut, const BZVector *vector, const BZMatrix *matrix);
38 extern void bzMatrixScaleRotateVector(BZVector *vectorOut, const BZVector *vector, const BZMatrix *matrix);
39 extern void bzMatrixTransformVector(BZVector *vectorOut, const BZVector *vector, const BZMatrix *matrix);
40
41 #ifdef __cplusplus
42 }
43 #endif
44
45 #endif