Exemplo n.º 1
0
 public static Mat22 operator +(Mat22 A, Mat22 B)
 {
     Mat22 C = new Mat22();
     C.Set(A.Col1 + B.Col1, A.Col2 + B.Col2);
     return C;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Compute the inverse of this matrix, such that inv(A) * A = identity.
 /// </summary>
 public Mat22 GetInverse()
 {
     float a = Col1.X, b = Col2.X, c = Col1.Y, d = Col2.Y;
     Mat22 B = new Mat22();
     float det = a * d - b * c;
     //Box2DXDebug.Assert(det != 0.0f);
     Debug.Assert(det != 0.0f);
     det = 1.0f / det;
     B.Col1.X = det * d; B.Col2.X = -det * b;
     B.Col1.Y = -det * c; B.Col2.Y = det * a;
     return B;
 }