8 int odd(int x) { return ((x) & 1); }
10 typedef float matriz_data[2][2];
12 const matriz_data MATIDEN= { {1, 0}, {0, 1}};
14 #define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data))
22 void Matriz::rota(int code)
28 cs = (odd(code)) ? 0: 1 - code;
29 sn = (odd(code)) ? 2 - code: 0;
30 r[0][0] = cs; r[0][1] = sn;
31 r[1][0] = -r[0][1]; r[1][1] = r[0][0];
36 void Matriz::escala(float x, float y)
40 s[0][0] = x; s[1][1] = y;
45 void Matriz::matmat(matriz_data & a)
48 for (int i = 0;i < 2; ++i) {
49 c[0][i] = a[0][0] * m[0][i] + a[0][1] * m[1][i];
50 c[1][i] = a[1][0] * m[0][i] + a[1][1] * m[1][i];
56 void Matriz::transf(float xp, float yp, float & x, float & y)
58 x = m[0][0] * xp + m[0][1] * yp;
59 y = m[1][0] * xp + m[1][1] * yp;