NewTOAPIA.Drawing.Transform2D.Invert C# (CSharp) Method

Invert() public method

public Invert ( ) : bool
return bool
        public bool Invert()
        {
            fTransformMatrix = fTransformMatrix.Inverse;

            float det = fMatrix.eM11 * fMatrix.eM22 - fMatrix.eM21 * fMatrix.eM12;

            if (det == 0)
                return false;

            XFORM old = new XFORM(fMatrix);

            fMatrix.eM11 = old.eM22 / det;
            fMatrix.eM12 = -old.eM12 / det;
            fMatrix.eM21 = -old.eM21 / det;
            fMatrix.eM22 = old.eM11 / det;

            fMatrix.eDx = -(fMatrix.eM11 * old.eDx + fMatrix.eM21 * old.eDy);
            fMatrix.eDy = -(fMatrix.eM12 * old.eDx + fMatrix.eM22 * old.eDy);

            return true;
        }