class_transform2d.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Transform2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Transform2D:
  5. Transform2D
  6. ===========
  7. **Category:** Built-In Types
  8. Brief Description
  9. -----------------
  10. 2D Transformation. 3x2 matrix.
  11. Properties
  12. ----------
  13. +-------------------------------+--------------------------------------------------+
  14. | :ref:`Vector2<class_Vector2>` | :ref:`origin<class_Transform2D_property_origin>` |
  15. +-------------------------------+--------------------------------------------------+
  16. | :ref:`Vector2<class_Vector2>` | :ref:`x<class_Transform2D_property_x>` |
  17. +-------------------------------+--------------------------------------------------+
  18. | :ref:`Vector2<class_Vector2>` | :ref:`y<class_Transform2D_property_y>` |
  19. +-------------------------------+--------------------------------------------------+
  20. Methods
  21. -------
  22. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Transform2D<class_Transform2D>` | :ref:`Transform2D<class_Transform2D_method_Transform2D>` **(** :ref:`Transform<class_Transform>` from **)** |
  24. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Transform2D<class_Transform2D>` | :ref:`Transform2D<class_Transform2D_method_Transform2D>` **(** :ref:`Vector2<class_Vector2>` x_axis, :ref:`Vector2<class_Vector2>` y_axis, :ref:`Vector2<class_Vector2>` origin **)** |
  26. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Transform2D<class_Transform2D>` | :ref:`Transform2D<class_Transform2D_method_Transform2D>` **(** :ref:`float<class_float>` rotation, :ref:`Vector2<class_Vector2>` position **)** |
  28. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Transform2D<class_Transform2D>` | :ref:`affine_inverse<class_Transform2D_method_affine_inverse>` **(** **)** |
  30. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Vector2<class_Vector2>` | :ref:`basis_xform<class_Transform2D_method_basis_xform>` **(** :ref:`Vector2<class_Vector2>` v **)** |
  32. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Vector2<class_Vector2>` | :ref:`basis_xform_inv<class_Transform2D_method_basis_xform_inv>` **(** :ref:`Vector2<class_Vector2>` v **)** |
  34. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Vector2<class_Vector2>` | :ref:`get_origin<class_Transform2D_method_get_origin>` **(** **)** |
  36. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`float<class_float>` | :ref:`get_rotation<class_Transform2D_method_get_rotation>` **(** **)** |
  38. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Vector2<class_Vector2>` | :ref:`get_scale<class_Transform2D_method_get_scale>` **(** **)** |
  40. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Transform2D<class_Transform2D>` | :ref:`interpolate_with<class_Transform2D_method_interpolate_with>` **(** :ref:`Transform2D<class_Transform2D>` transform, :ref:`float<class_float>` weight **)** |
  42. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Transform2D<class_Transform2D>` | :ref:`inverse<class_Transform2D_method_inverse>` **(** **)** |
  44. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Transform2D<class_Transform2D>` | :ref:`orthonormalized<class_Transform2D_method_orthonormalized>` **(** **)** |
  46. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Transform2D<class_Transform2D>` | :ref:`rotated<class_Transform2D_method_rotated>` **(** :ref:`float<class_float>` phi **)** |
  48. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Transform2D<class_Transform2D>` | :ref:`scaled<class_Transform2D_method_scaled>` **(** :ref:`Vector2<class_Vector2>` scale **)** |
  50. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Transform2D<class_Transform2D>` | :ref:`translated<class_Transform2D_method_translated>` **(** :ref:`Vector2<class_Vector2>` offset **)** |
  52. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Variant<class_Variant>` | :ref:`xform<class_Transform2D_method_xform>` **(** :ref:`Variant<class_Variant>` v **)** |
  54. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Variant<class_Variant>` | :ref:`xform_inv<class_Transform2D_method_xform_inv>` **(** :ref:`Variant<class_Variant>` v **)** |
  56. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. Constants
  58. ---------
  59. .. _class_Transform2D_constant_IDENTITY:
  60. .. _class_Transform2D_constant_FLIP_X:
  61. .. _class_Transform2D_constant_FLIP_Y:
  62. - **IDENTITY** = **Transform2D( 1, 0, 0, 1, 0, 0 )**
  63. - **FLIP_X** = **Transform2D( -1, 0, 0, 1, 0, 0 )**
  64. - **FLIP_Y** = **Transform2D( 1, 0, 0, -1, 0, 0 )**
  65. Description
  66. -----------
  67. Represents one or many transformations in 2D space such as translation, rotation, or scaling. It consists of a two :ref:`Vector2<class_Vector2>` x, y and :ref:`Vector2<class_Vector2>` "origin". It is similar to a 3x2 matrix.
  68. Property Descriptions
  69. ---------------------
  70. .. _class_Transform2D_property_origin:
  71. - :ref:`Vector2<class_Vector2>` **origin**
  72. The transform's translation offset.
  73. .. _class_Transform2D_property_x:
  74. - :ref:`Vector2<class_Vector2>` **x**
  75. The X axis of 2x2 basis matrix containing 2 :ref:`Vector2<class_Vector2>`\ 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.
  76. .. _class_Transform2D_property_y:
  77. - :ref:`Vector2<class_Vector2>` **y**
  78. The Y axis of 2x2 basis matrix containing 2 :ref:`Vector2<class_Vector2>`\ 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.
  79. Method Descriptions
  80. -------------------
  81. .. _class_Transform2D_method_Transform2D:
  82. - :ref:`Transform2D<class_Transform2D>` **Transform2D** **(** :ref:`Transform<class_Transform>` from **)**
  83. Constructs the transform from a 3D :ref:`Transform<class_Transform>`.
  84. - :ref:`Transform2D<class_Transform2D>` **Transform2D** **(** :ref:`Vector2<class_Vector2>` x_axis, :ref:`Vector2<class_Vector2>` y_axis, :ref:`Vector2<class_Vector2>` origin **)**
  85. Constructs the transform from 3 :ref:`Vector2<class_Vector2>`\ s representing x, y, and origin.
  86. - :ref:`Transform2D<class_Transform2D>` **Transform2D** **(** :ref:`float<class_float>` rotation, :ref:`Vector2<class_Vector2>` position **)**
  87. Constructs the transform from a given angle (in radians) and position.
  88. .. _class_Transform2D_method_affine_inverse:
  89. - :ref:`Transform2D<class_Transform2D>` **affine_inverse** **(** **)**
  90. Returns the inverse of the matrix.
  91. .. _class_Transform2D_method_basis_xform:
  92. - :ref:`Vector2<class_Vector2>` **basis_xform** **(** :ref:`Vector2<class_Vector2>` v **)**
  93. Transforms the given vector by this transform's basis (no translation).
  94. .. _class_Transform2D_method_basis_xform_inv:
  95. - :ref:`Vector2<class_Vector2>` **basis_xform_inv** **(** :ref:`Vector2<class_Vector2>` v **)**
  96. Inverse-transforms the given vector by this transform's basis (no translation).
  97. .. _class_Transform2D_method_get_origin:
  98. - :ref:`Vector2<class_Vector2>` **get_origin** **(** **)**
  99. Returns the transform's origin (translation).
  100. .. _class_Transform2D_method_get_rotation:
  101. - :ref:`float<class_float>` **get_rotation** **(** **)**
  102. Returns the transform's rotation (in radians).
  103. .. _class_Transform2D_method_get_scale:
  104. - :ref:`Vector2<class_Vector2>` **get_scale** **(** **)**
  105. Returns the scale.
  106. .. _class_Transform2D_method_interpolate_with:
  107. - :ref:`Transform2D<class_Transform2D>` **interpolate_with** **(** :ref:`Transform2D<class_Transform2D>` transform, :ref:`float<class_float>` weight **)**
  108. Returns a transform interpolated between this transform and another by a given weight (0-1).
  109. .. _class_Transform2D_method_inverse:
  110. - :ref:`Transform2D<class_Transform2D>` **inverse** **(** **)**
  111. 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).
  112. .. _class_Transform2D_method_orthonormalized:
  113. - :ref:`Transform2D<class_Transform2D>` **orthonormalized** **(** **)**
  114. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
  115. .. _class_Transform2D_method_rotated:
  116. - :ref:`Transform2D<class_Transform2D>` **rotated** **(** :ref:`float<class_float>` phi **)**
  117. Rotates the transform by the given angle (in radians).
  118. .. _class_Transform2D_method_scaled:
  119. - :ref:`Transform2D<class_Transform2D>` **scaled** **(** :ref:`Vector2<class_Vector2>` scale **)**
  120. Scales the transform by the given factor.
  121. .. _class_Transform2D_method_translated:
  122. - :ref:`Transform2D<class_Transform2D>` **translated** **(** :ref:`Vector2<class_Vector2>` offset **)**
  123. Translates the transform by the given offset.
  124. .. _class_Transform2D_method_xform:
  125. - :ref:`Variant<class_Variant>` **xform** **(** :ref:`Variant<class_Variant>` v **)**
  126. Transforms the given :ref:`Vector2<class_Vector2>` or :ref:`Rect2<class_Rect2>` by this transform.
  127. .. _class_Transform2D_method_xform_inv:
  128. - :ref:`Variant<class_Variant>` **xform_inv** **(** :ref:`Variant<class_Variant>` v **)**
  129. Inverse-transforms the given :ref:`Vector2<class_Vector2>` or :ref:`Rect2<class_Rect2>` by this transform.