public class Matrice
{
private double[,] mat;
public Matrice()
mat = new double[3, 3];
for (int row = 0; row < 3; row++)
for (int col = 0; col < 3; col++)
mat[row, col] = (row == col) ? 1.0 : 0.0;
}
public double this[int row, int col]
get { return mat[row, col]; }
set { mat[row, col] = value; }
public static Matrice operator *(Matrice m1, Matrice m2)
Matrice m = new Matrice();
m[row, col] = 0;
for (int cpt = 0; cpt < 3; cpt++)
m[row, col] += m1[row, cpt] * m2[cpt, col];
return m;
public static Matrice Translation(double dx, double dy)
m[0, 2] = dx;
m[1, 2] = dy;
public static Matrice Rotation(double dx, double dy, double angle)
double c = Math.Cos(angle);
double s = Math.Sin(angle);
m[0, 0] = c;
m[0, 1] = -s;
m[0, 2] = dx * (1 - c) + (dy * s);
m[1, 0] = s;
m[1, 1] = c;
m[1, 2] = dy * (1 - c) - (dx * s);
m[2, 0] = m[2, 1] = 0;
m[2, 2] = 1;