Exemplo n.º 1
0
 public void Scale(double xScale, double yScale)
 {
     Matrix2D iMat = new Matrix2D();
     iMat.mMat[0,0] = xScale;
     iMat.mMat[1,1] = yScale;
     Multiply(iMat);
 }
Exemplo n.º 2
0
 public void Translate(double x, double y)
 {
     Matrix2D iMat = new Matrix2D();
     iMat.mMat[2,0] = x;
     iMat.mMat[2,1] = y;
     Multiply(iMat);
 }
Exemplo n.º 3
0
 public void Rotate(double radian)
 {
     double sin = Math.Sin(radian);
     double cos = Math.Cos(radian);
     Matrix2D iMat = new Matrix2D();
     iMat.mMat[0,0] = cos;
     iMat.mMat[0,1] = sin;
     iMat.mMat[1,0] = -sin;
     iMat.mMat[1,1] = cos;
     Multiply(iMat);
 }
Exemplo n.º 4
0
        private void Multiply(Matrix2D iMat)
        {
            double[,] newMat = new double[3,3]{ {0,0,0}, {0,0,0}, {0,0,0}};

            for(int i=0;i<3;i++)
                for(int j=0; j<3; j++)
                    for(int k=0; k<3; k++)
                        newMat[i,j] += mMat[i,k] * iMat.mMat[k,j];

            mMat = newMat;
        }