Download Now

    Reference TMatrix2x3

    Declared in Codebot.Geometry.pas on line 308

    TMatrix2x3 is a two dimensional affine matrix, which can rotate, scale, skew, and translate. A point is transformed as (X*A + Y*C + TX, X*B + Y*D + TY), the same layout used by vector graphics libraries.
    A * B gives the matrix which applies B first and then A.
      TMatrix2x3 = record
      public
        { Create a matrix from its fields }
        class function Create(A, B, C, D, TX, TY: Float): TMatrix2x3; static; inline;
        { Create from fields given a row at a time, as they are written on paper }
        class function CreateTranspose(A, C, TX, B, D, TY: Float): TMatrix2x3; static; inline;
        { Create a translation }
        class function CreateTranslate(const V: TVec2): TMatrix2x3; static;
        { Create a scale }
        class function CreateScale(X, Y: Float): TMatrix2x3; static;
        { Create a rotation }
        class function CreateRotate(Radians: Float): TMatrix2x3; static;
        { Create a rotation followed by a translation }
        class function CreateRigid(const V: TVec2; Radians: Float): TMatrix2x3; static;
        { A two dimensional matrix placed in the XY plane of a 4x4 matrix }
        class operator Implicit(const M: TMatrix2x3): TMatrix4x4;
        { Reset to the identity matrix }
        procedure Identity;
        { Returns the inverse of the matrix }
        function Inverse: TMatrix2x3;
        { The inverse of a matrix which only rotates and translates }
        function RigidInverse: TMatrix2x3;
        { Transform a point, which is moved by the translation }
        function Transform(const V: TVec2): TVec2; inline;
        { Transform a direction, which is not moved by the translation }
        function TransformVector(const V: TVec2): TVec2; inline;
        A: Float;
        B: Float;
        C: Float;
        D: Float;
        TX: Float;
        TY: Float;
        V: array[0..5] of Float;
      end;

    See also

    Float in Codebot.System.pas