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