blob: d6066475e9c2d51e211c36c9a860eae17b877c32 (
plain)
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
39
40
41
42
43
44
45
|
#pragma once
mat3 translate(float Tx, float Ty)
{
mat3* res = new mat3(1.f);
(*res)[0][2] = Tx;
(*res)[1][2] = Ty;
return *res;
}
mat3 scale(float Sx, float Sy)
{
mat3* res = new mat3(1.f);
(*res)[0][0] = Sx;
(*res)[1][1] = Sy;
return *res;
}
mat3 scale(float S)
{
return scale(S, S);
}
mat3 rotate(float theta)
{
mat3* res = new mat3(1.f);
(*res)[0][0] = (*res)[1][1] = (float)cos(theta);
(*res)[0][1] = (float)sin(theta);
(*res)[1][0] = -(*res)[0][1];
return *res;
}
mat3 mirrorX()
{
mat3* res = new mat3(1.f);
(*res)[1][1] = -1;
return *res;
}
mat3 mirrorY()
{
mat3* res = new mat3(1.f);
(*res)[0][0] = -1;
return *res;
}
|