Transform2D

    2D Transformation. 3x2 matrix.

    Properties

    Transform2D ( from )
    Transform2D ( Vector2 x_axis, y_axis, Vector2 origin )
    Transform2D ( rotation, Vector2 position )
    affine_inverse ( )
    basis_xform ( v )
    Vector2 ( Vector2 v )
    get_origin ( )
    get_rotation ( )
    get_scale ( )
    interpolate_with ( transform, float weight )
    inverse ( )
    orthonormalized ( )
    rotated ( phi )
    Transform2D ( Vector2 scale )
    translated ( offset )
    Variant ( Variant v )
    xform_inv ( v )

    Constants

    • IDENTITY = Transform2D( 1, 0, 0, 1, 0, 0 )Transform2D with no translation, rotation or scaling applied. When applied to other data structures, performs no transformation.
    • FLIP_X = Transform2D( -1, 0, 0, 1, 0, 0 )Transform2D with mirroring applied parallel to the X axis.

    Represents one or many transformations in 2D space such as translation, rotation, or scaling. It consists of a two x, y and Vector2 “origin”. It is similar to a 3x2 matrix.

    Property Descriptions

    • origin

    The transform’s translation offset.


    The X axis of 2x2 basis matrix containing 2 s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.


    The Y axis of 2x2 basis matrix containing 2 s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.

    Constructs the transform from a 3D Transform.



    • Transform2D ( float rotation, position )

    Constructs the transform from a given angle (in radians) and position.


    Returns the inverse of the matrix.


    Transforms the given vector by this transform’s basis (no translation).


    Inverse-transforms the given vector by this transform’s basis (no translation).


    Returns the transform’s origin (translation).


    • get_rotation ( )

    Returns the transform’s rotation (in radians).



    Returns a transform interpolated between this transform and another by a given weight (0-1).


    Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).


    • orthonormalized ( )

    Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.


    Rotates the transform by the given angle (in radians).


    Scales the transform by the given factor.


    Translates the transform by the given offset.



    Inverse-transforms the given Vector2 or by this transform.