Example #1
0
 public void AddMatrix2(Matrix2 other)
 {
     elements[0, 0] += other.elements[0, 0];
     elements[0, 1] += other.elements[0, 1];
     elements[1, 0] += other.elements[1, 0];
     elements[0, 1] += other.elements[1, 1];
 }
Example #2
0
 public void ApplyMatrix(Matrix2 m, bool saveMatrix)
 {
     p[0].MulMatrix2(m);
     p[1].MulMatrix2(m);
     p[2].MulMatrix2(m);
     p[3].MulMatrix2(m);
     if (saveMatrix)
         matrix = m;
 }
Example #3
0
        public void MulMatrix2(Matrix2 other)
        {
            Matrix2 temp = new Matrix2();

            temp.elements[0, 0] = (elements[0, 0] * other.elements[0, 0]) + (elements[1, 0] * other.elements[0, 1]);
            temp.elements[1, 0] = (elements[0, 0] * other.elements[0, 1]) + (elements[1, 0] * other.elements[1, 1]);
            temp.elements[0, 1] = (elements[0, 1] * other.elements[0, 0]) + (elements[1, 1] * other.elements[0, 1]);
            temp.elements[1, 1] = (elements[0, 1] * other.elements[1, 0]) + (elements[1, 1] * other.elements[1, 1]);

            elements = temp.elements;
        }
Example #4
0
 public bool IsEqual(Matrix2 other)
 {
     if (elements[0, 0] != other.elements[0, 0])
         return false;
     if (elements[0, 1] != other.elements[0, 1])
         return false;
     if (elements[1, 0] != other.elements[1, 0])
         return false;
     if (elements[1, 1] != other.elements[1, 1])
         return false;
     return true;
 }
Example #5
0
 public bool IsEqual(Matrix2 other)
 {
     if (elements[0, 0] != other.elements[0, 0])
     {
         return(false);
     }
     if (elements[0, 1] != other.elements[0, 1])
     {
         return(false);
     }
     if (elements[1, 0] != other.elements[1, 0])
     {
         return(false);
     }
     if (elements[1, 1] != other.elements[1, 1])
     {
         return(false);
     }
     return(true);
 }
Example #6
0
 public void SubtractMatrix2(Matrix2 other)
 {
     elements[0, 0] -= other.elements[0, 0];
     elements[0, 1] -= other.elements[0, 1];
     elements[1, 0] -= other.elements[1, 0];
     elements[0, 1] -= other.elements[1, 1];
 }
Example #7
0
        public void MulMatrix2(Matrix2 m)
        {
            float xx = x;
            float yy = y;

            x = (m.elements[0, 0] * xx) + (m.elements[0, 1] * yy);
            y = (m.elements[1, 0] * xx) + (m.elements[1, 1] * yy);
        }