public static void Decompose(Matrix2 m, out float scaleX, out float scaleY, out float shearXY, out float rot) { Matrix2 mtx = m; scaleX = Point.Length(mtx[0]) * Matrix2.Sign(mtx[0][0]); mtx[0] = mtx[0] / scaleX; shearXY = Point.Dot(mtx[0], mtx[1]); mtx[1] -= mtx[0] * shearXY; scaleY = Point.Length(mtx[1]) * Matrix2.Sign(mtx[1][1]); mtx[1] = mtx[1] / scaleY; shearXY /= scaleY; rot = (float)Math.Atan2(-mtx[1][0], mtx[1][1]); }
public void SetUpper2x2(Matrix2 m) { this[0] = m[0]; this[1] = m[1]; }
public static Matrix2 PreScale(float scaleX, float scaleY, Matrix2 m) { return(new Matrix2(m[0][0] * scaleX, m[0][1] * scaleX, m[1][0] * scaleY, m[1][1] * scaleY)); }
public static Matrix2 PostScale(Matrix2 m, float scaleX, float scaleY) { return(new Matrix2(m[0][0] * scaleX, m[0][1] * scaleY, m[1][0] * scaleX, m[1][1] * scaleY)); }
public static Matrix2 Inverse(Matrix2 m, float determinant) { return(new Matrix2(m[1][1], -m[0][1], -m[1][0], m[0][0]) / determinant); }
public static Matrix2 Inverse(Matrix2 m) { return(Inverse(m, Determinant(m))); }
public static float Determinant(Matrix2 m) { return(m[0][0] * m[1][1] - m[0][1] * m[1][0]); }
public static Matrix2 Transpose(Matrix2 m) { return(new Matrix2(m[0][0], m[1][0], m[0][1], m[1][1])); }
public bool Equals(Matrix2 m) { return(this == m); }