public static bool EpsilonEquals(Matrix2 m1, Matrix2 m2, float epsilon) { float diff; for (int i = 0; i < 4; i++) { diff = m1[i % 4, i / 4] - m2[i % 4, i / 4]; if ((diff < 0 ? -diff : diff) > epsilon) { return(false); } } return(true); }
public static Matrix2 Inverse(Matrix2 m) { float det = m.Det(); return(new Matrix2(m.m11, m.m10, m.m01, m.m00) * (1.0F / det)); }
public static Vector2 Transform(Vector2 v, Matrix2 m) => new Vector2 { x = v.x * m.m00 + v.y * m.m01, y = v.x * m.m10 + v.y * m.m11, };