Exemple #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];
 }
Exemple #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;
 }
Exemple #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;
        }
Exemple #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;
 }
Exemple #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);
 }
Exemple #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];
 }
Exemple #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);
        }