Example #1
0
 public Transformer(double angle, Cartesian scale, Cartesian offset)
 {
     this.angle  = angle;
     this.scale  = scale;
     this.offset = offset;
     this.matrix = Matrix33.CreateMatrix(scale, offset, angle);
 }
Example #2
0
 public Transformer()
 {
     this.angle  = 0.0;
     this.scale  = new Cartesian(1.0, 1.0);
     this.offset = new Cartesian();
     this.matrix = new Matrix33();
 }
Example #3
0
        public bool Equals(Matrix33 other)
        {
            bool result = true;

            for (int x = 0; result && x < 3; x++)
            {
                for (int y = 0; result && y < 3; y++)
                {
                    result = matrix[x, y] == other.matrix[x, y];
                }
            }
            return(result);
        }
Example #4
0
        public static Matrix33 Multiply(Matrix33 l, Matrix33 r)
        {
            double[,] matrix = new double[3, 3];

            matrix[0, 0] = l.matrix[0, 0] * r.matrix[0, 0] +
                           l.matrix[0, 1] * r.matrix[1, 0] +
                           l.matrix[0, 2] * r.matrix[2, 0];

            matrix[0, 1] = l.matrix[0, 0] * r.matrix[0, 1] +
                           l.matrix[0, 1] * r.matrix[1, 1] +
                           l.matrix[0, 2] * r.matrix[2, 1];

            matrix[0, 2] = l.matrix[0, 0] * r.matrix[0, 2] +
                           l.matrix[0, 1] * r.matrix[1, 2] +
                           l.matrix[0, 2] * r.matrix[2, 2];


            matrix[1, 0] = l.matrix[1, 0] * r.matrix[0, 0] +
                           l.matrix[1, 1] * r.matrix[1, 0] +
                           l.matrix[1, 2] * r.matrix[2, 0];

            matrix[1, 1] = l.matrix[1, 0] * r.matrix[0, 1] +
                           l.matrix[1, 1] * r.matrix[1, 1] +
                           l.matrix[1, 2] * r.matrix[2, 1];

            matrix[1, 2] = l.matrix[1, 0] * r.matrix[0, 2] +
                           l.matrix[1, 1] * r.matrix[1, 2] +
                           l.matrix[1, 2] * r.matrix[2, 2];


            matrix[2, 0] = l.matrix[2, 0] * r.matrix[0, 0] +
                           l.matrix[2, 1] * r.matrix[1, 0] +
                           l.matrix[2, 2] * r.matrix[2, 0];

            matrix[2, 1] = l.matrix[2, 0] * r.matrix[0, 1] +
                           l.matrix[2, 1] * r.matrix[1, 1] +
                           l.matrix[2, 2] * r.matrix[2, 1];

            matrix[2, 2] = l.matrix[2, 0] * r.matrix[0, 2] +
                           l.matrix[2, 1] * r.matrix[1, 2] +
                           l.matrix[2, 2] * r.matrix[2, 2];

            return(new Matrix33(matrix));
        }