:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Transform2D.xml. .. _class_Transform2D: Transform2D =========== A 2×3 matrix representing a 2D transformation. .. rst-class:: classref-introduction-group Description ----------- A 2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, and scaling. It consists of three :ref:`Vector2` values: :ref:`x`, :ref:`y`, and the :ref:`origin`. For a general introduction, see the :doc:`Matrices and transforms <../tutorials/math/matrices_and_transforms>` tutorial. .. note:: There are notable differences when using this API with C#. See :ref:`doc_c_sharp_differences` for more information. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Math documentation index <../tutorials/math/index>` - :doc:`Matrices and transforms <../tutorials/math/matrices_and_transforms>` - `Matrix Transform Demo `__ - `2.5D Game Demo `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------+--------------------------------------------------+-------------------+ | :ref:`Vector2` | :ref:`origin` | ``Vector2(0, 0)`` | +-------------------------------+--------------------------------------------------+-------------------+ | :ref:`Vector2` | :ref:`x` | ``Vector2(1, 0)`` | +-------------------------------+--------------------------------------------------+-------------------+ | :ref:`Vector2` | :ref:`y` | ``Vector2(0, 1)`` | +-------------------------------+--------------------------------------------------+-------------------+ .. rst-class:: classref-reftable-group Constructors ------------ .. table:: :widths: auto +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`Transform2D`\ (\ ) | +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`Transform2D`\ (\ from\: :ref:`Transform2D`\ ) | +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`Transform2D`\ (\ rotation\: :ref:`float`, position\: :ref:`Vector2`\ ) | +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`Transform2D`\ (\ rotation\: :ref:`float`, scale\: :ref:`Vector2`, skew\: :ref:`float`, position\: :ref:`Vector2`\ ) | +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`Transform2D`\ (\ x_axis\: :ref:`Vector2`, y_axis\: :ref:`Vector2`, origin\: :ref:`Vector2`\ ) | +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`affine_inverse`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`basis_xform`\ (\ v\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`basis_xform_inv`\ (\ v\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`determinant`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_origin`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_rotation`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_scale`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_skew`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`interpolate_with`\ (\ xform\: :ref:`Transform2D`, weight\: :ref:`float`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`inverse`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_conformal`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_equal_approx`\ (\ xform\: :ref:`Transform2D`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_finite`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`looking_at`\ (\ target\: :ref:`Vector2` = Vector2(0, 0)\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`orthonormalized`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`rotated`\ (\ angle\: :ref:`float`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`rotated_local`\ (\ angle\: :ref:`float`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`scaled`\ (\ scale\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`scaled_local`\ (\ scale\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`translated`\ (\ offset\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`translated_local`\ (\ offset\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Operators --------- .. table:: :widths: auto +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`operator !=`\ (\ right\: :ref:`Transform2D`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedVector2Array` | :ref:`operator *`\ (\ right\: :ref:`PackedVector2Array`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`operator *`\ (\ right\: :ref:`Rect2`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`operator *`\ (\ right\: :ref:`Transform2D`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`operator *`\ (\ right\: :ref:`Vector2`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`operator *`\ (\ right\: :ref:`float`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`operator *`\ (\ right\: :ref:`int`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`operator /`\ (\ right\: :ref:`float`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`operator /`\ (\ right\: :ref:`int`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`operator ==`\ (\ right\: :ref:`Transform2D`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`operator []`\ (\ index\: :ref:`int`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Constants --------- .. _class_Transform2D_constant_IDENTITY: .. rst-class:: classref-constant **IDENTITY** = ``Transform2D(1, 0, 0, 1, 0, 0)`` :ref:`🔗` The identity **Transform2D** with no translation, rotation or scaling applied. When applied to other data structures, :ref:`IDENTITY` performs no transformation. .. _class_Transform2D_constant_FLIP_X: .. rst-class:: classref-constant **FLIP_X** = ``Transform2D(-1, 0, 0, 1, 0, 0)`` :ref:`🔗` The **Transform2D** that will flip something along the X axis. .. _class_Transform2D_constant_FLIP_Y: .. rst-class:: classref-constant **FLIP_Y** = ``Transform2D(1, 0, 0, -1, 0, 0)`` :ref:`🔗` The **Transform2D** that will flip something along the Y axis. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_Transform2D_property_origin: .. rst-class:: classref-property :ref:`Vector2` **origin** = ``Vector2(0, 0)`` :ref:`🔗` The origin vector (column 2, the third column). Equivalent to array index ``2``. The origin vector represents translation. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_property_x: .. rst-class:: classref-property :ref:`Vector2` **x** = ``Vector2(1, 0)`` :ref:`🔗` The basis matrix's X vector (column 0). Equivalent to array index ``0``. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_property_y: .. rst-class:: classref-property :ref:`Vector2` **y** = ``Vector2(0, 1)`` :ref:`🔗` The basis matrix's Y vector (column 1). Equivalent to array index ``1``. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Constructor Descriptions ------------------------ .. _class_Transform2D_constructor_Transform2D: .. rst-class:: classref-constructor :ref:`Transform2D` **Transform2D**\ (\ ) :ref:`🔗` Constructs a default-initialized **Transform2D** set to :ref:`IDENTITY`. .. rst-class:: classref-item-separator ---- .. rst-class:: classref-constructor :ref:`Transform2D` **Transform2D**\ (\ from\: :ref:`Transform2D`\ ) Constructs a **Transform2D** as a copy of the given **Transform2D**. .. rst-class:: classref-item-separator ---- .. rst-class:: classref-constructor :ref:`Transform2D` **Transform2D**\ (\ rotation\: :ref:`float`, position\: :ref:`Vector2`\ ) Constructs the transform from a given angle (in radians) and position. .. rst-class:: classref-item-separator ---- .. rst-class:: classref-constructor :ref:`Transform2D` **Transform2D**\ (\ rotation\: :ref:`float`, scale\: :ref:`Vector2`, skew\: :ref:`float`, position\: :ref:`Vector2`\ ) Constructs the transform from a given angle (in radians), scale, skew (in radians) and position. .. rst-class:: classref-item-separator ---- .. rst-class:: classref-constructor :ref:`Transform2D` **Transform2D**\ (\ x_axis\: :ref:`Vector2`, y_axis\: :ref:`Vector2`, origin\: :ref:`Vector2`\ ) Constructs the transform from 3 :ref:`Vector2` values representing :ref:`x`, :ref:`y`, and the :ref:`origin` (the three column vectors). .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_Transform2D_method_affine_inverse: .. rst-class:: classref-method :ref:`Transform2D` **affine_inverse**\ (\ ) |const| :ref:`🔗` Returns the inverse of the transform, under the assumption that the basis is invertible (must have non-zero determinant). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_basis_xform: .. rst-class:: classref-method :ref:`Vector2` **basis_xform**\ (\ v\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a vector transformed (multiplied) by the basis matrix. This method does not account for translation (the :ref:`origin` vector). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_basis_xform_inv: .. rst-class:: classref-method :ref:`Vector2` **basis_xform_inv**\ (\ v\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a vector transformed (multiplied) by the inverse basis matrix, under the assumption that the basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not). This method does not account for translation (the :ref:`origin` vector). \ ``transform.basis_xform_inv(vector)`` is equivalent to ``transform.inverse().basis_xform(vector)``. See :ref:`inverse`. For non-orthonormal transforms (e.g. with scaling) ``transform.affine_inverse().basis_xform(vector)`` can be used instead. See :ref:`affine_inverse`. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_determinant: .. rst-class:: classref-method :ref:`float` **determinant**\ (\ ) |const| :ref:`🔗` Returns the determinant of the basis matrix. If the basis is uniformly scaled, then its determinant equals the square of the scale factor. A negative determinant means the basis was flipped, so one part of the scale is negative. A zero determinant means the basis isn't invertible, and is usually considered invalid. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_get_origin: .. rst-class:: classref-method :ref:`Vector2` **get_origin**\ (\ ) |const| :ref:`🔗` Returns the transform's origin (translation). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_get_rotation: .. rst-class:: classref-method :ref:`float` **get_rotation**\ (\ ) |const| :ref:`🔗` Returns the transform's rotation (in radians). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_get_scale: .. rst-class:: classref-method :ref:`Vector2` **get_scale**\ (\ ) |const| :ref:`🔗` Returns the scale. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_get_skew: .. rst-class:: classref-method :ref:`float` **get_skew**\ (\ ) |const| :ref:`🔗` Returns the transform's skew (in radians). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_interpolate_with: .. rst-class:: classref-method :ref:`Transform2D` **interpolate_with**\ (\ xform\: :ref:`Transform2D`, weight\: :ref:`float`\ ) |const| :ref:`🔗` Returns a transform interpolated between this transform and another by a given ``weight`` (on the range of 0.0 to 1.0). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_inverse: .. rst-class:: classref-method :ref:`Transform2D` **inverse**\ (\ ) |const| :ref:`🔗` Returns the inverse of the transform, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not). Use :ref:`affine_inverse` for non-orthonormal transforms (e.g. with scaling). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_is_conformal: .. rst-class:: classref-method :ref:`bool` **is_conformal**\ (\ ) |const| :ref:`🔗` Returns ``true`` if the transform's basis is conformal, meaning it preserves angles and distance ratios, and may only be composed of rotation and uniform scale. Returns ``false`` if the transform's basis has non-uniform scale or shear/skew. This can be used to validate if the transform is non-distorted, which is important for physics and other use cases. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_is_equal_approx: .. rst-class:: classref-method :ref:`bool` **is_equal_approx**\ (\ xform\: :ref:`Transform2D`\ ) |const| :ref:`🔗` Returns ``true`` if this transform and ``xform`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx` on each component. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_is_finite: .. rst-class:: classref-method :ref:`bool` **is_finite**\ (\ ) |const| :ref:`🔗` Returns ``true`` if this transform is finite, by calling :ref:`@GlobalScope.is_finite` on each component. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_looking_at: .. rst-class:: classref-method :ref:`Transform2D` **looking_at**\ (\ target\: :ref:`Vector2` = Vector2(0, 0)\ ) |const| :ref:`🔗` Returns a copy of the transform rotated such that the rotated X-axis points towards the ``target`` position. Operations take place in global space. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_orthonormalized: .. rst-class:: classref-method :ref:`Transform2D` **orthonormalized**\ (\ ) |const| :ref:`🔗` Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_rotated: .. rst-class:: classref-method :ref:`Transform2D` **rotated**\ (\ angle\: :ref:`float`\ ) |const| :ref:`🔗` Returns a copy of the transform rotated by the given ``angle`` (in radians). This method is an optimized version of multiplying the given transform ``X`` with a corresponding rotation transform ``R`` from the left, i.e., ``R * X``. This can be seen as transforming with respect to the global/parent frame. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_rotated_local: .. rst-class:: classref-method :ref:`Transform2D` **rotated_local**\ (\ angle\: :ref:`float`\ ) |const| :ref:`🔗` Returns a copy of the transform rotated by the given ``angle`` (in radians). This method is an optimized version of multiplying the given transform ``X`` with a corresponding rotation transform ``R`` from the right, i.e., ``X * R``. This can be seen as transforming with respect to the local frame. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_scaled: .. rst-class:: classref-method :ref:`Transform2D` **scaled**\ (\ scale\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a copy of the transform scaled by the given ``scale`` factor. This method is an optimized version of multiplying the given transform ``X`` with a corresponding scaling transform ``S`` from the left, i.e., ``S * X``. This can be seen as transforming with respect to the global/parent frame. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_scaled_local: .. rst-class:: classref-method :ref:`Transform2D` **scaled_local**\ (\ scale\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a copy of the transform scaled by the given ``scale`` factor. This method is an optimized version of multiplying the given transform ``X`` with a corresponding scaling transform ``S`` from the right, i.e., ``X * S``. This can be seen as transforming with respect to the local frame. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_translated: .. rst-class:: classref-method :ref:`Transform2D` **translated**\ (\ offset\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a copy of the transform translated by the given ``offset``. This method is an optimized version of multiplying the given transform ``X`` with a corresponding translation transform ``T`` from the left, i.e., ``T * X``. This can be seen as transforming with respect to the global/parent frame. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_method_translated_local: .. rst-class:: classref-method :ref:`Transform2D` **translated_local**\ (\ offset\: :ref:`Vector2`\ ) |const| :ref:`🔗` Returns a copy of the transform translated by the given ``offset``. This method is an optimized version of multiplying the given transform ``X`` with a corresponding translation transform ``T`` from the right, i.e., ``X * T``. This can be seen as transforming with respect to the local frame. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Operator Descriptions --------------------- .. _class_Transform2D_operator_neq_Transform2D: .. rst-class:: classref-operator :ref:`bool` **operator !=**\ (\ right\: :ref:`Transform2D`\ ) :ref:`🔗` Returns ``true`` if the transforms are not equal. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx` instead, which is more reliable. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_PackedVector2Array: .. rst-class:: classref-operator :ref:`PackedVector2Array` **operator ***\ (\ right\: :ref:`PackedVector2Array`\ ) :ref:`🔗` Transforms (multiplies) each element of the :ref:`Vector2` array by the given **Transform2D** matrix. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_Rect2: .. rst-class:: classref-operator :ref:`Rect2` **operator ***\ (\ right\: :ref:`Rect2`\ ) :ref:`🔗` Transforms (multiplies) the :ref:`Rect2` by the given **Transform2D** matrix. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_Transform2D: .. rst-class:: classref-operator :ref:`Transform2D` **operator ***\ (\ right\: :ref:`Transform2D`\ ) :ref:`🔗` Composes these two transformation matrices by multiplying them together. This has the effect of transforming the second transform (the child) by the first transform (the parent). .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_Vector2: .. rst-class:: classref-operator :ref:`Vector2` **operator ***\ (\ right\: :ref:`Vector2`\ ) :ref:`🔗` Transforms (multiplies) the :ref:`Vector2` by the given **Transform2D** matrix. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_float: .. rst-class:: classref-operator :ref:`Transform2D` **operator ***\ (\ right\: :ref:`float`\ ) :ref:`🔗` This operator multiplies all components of the **Transform2D**, including the :ref:`origin` vector, which scales it uniformly. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_mul_int: .. rst-class:: classref-operator :ref:`Transform2D` **operator ***\ (\ right\: :ref:`int`\ ) :ref:`🔗` This operator multiplies all components of the **Transform2D**, including the :ref:`origin` vector, which scales it uniformly. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_div_float: .. rst-class:: classref-operator :ref:`Transform2D` **operator /**\ (\ right\: :ref:`float`\ ) :ref:`🔗` This operator divides all components of the **Transform2D**, including the :ref:`origin` vector, which inversely scales it uniformly. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_div_int: .. rst-class:: classref-operator :ref:`Transform2D` **operator /**\ (\ right\: :ref:`int`\ ) :ref:`🔗` This operator divides all components of the **Transform2D**, including the :ref:`origin` vector, which inversely scales it uniformly. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_eq_Transform2D: .. rst-class:: classref-operator :ref:`bool` **operator ==**\ (\ right\: :ref:`Transform2D`\ ) :ref:`🔗` Returns ``true`` if the transforms are exactly equal. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx` instead, which is more reliable. .. rst-class:: classref-item-separator ---- .. _class_Transform2D_operator_idx_int: .. rst-class:: classref-operator :ref:`Vector2` **operator []**\ (\ index\: :ref:`int`\ ) :ref:`🔗` Access transform components using their index. ``t[0]`` is equivalent to ``t.x``, ``t[1]`` is equivalent to ``t.y``, and ``t[2]`` is equivalent to ``t.origin``. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`