Transform2D.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Transform2D" version="3.4">
  3. <brief_description>
  4. 2D transformation (2×3 matrix).
  5. </brief_description>
  6. <description>
  7. 2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a three [Vector2] values: [member x], [member y], and the [member origin].
  8. For more information, read the "Matrices and transforms" documentation article.
  9. </description>
  10. <tutorials>
  11. <link title="Math tutorial index">https://docs.godotengine.org/en/3.3/tutorials/math/index.html</link>
  12. <link title="Matrices and transforms">https://docs.godotengine.org/en/3.3/tutorials/math/matrices_and_transforms.html</link>
  13. <link title="Matrix Transform Demo">https://godotengine.org/asset-library/asset/584</link>
  14. <link title="2.5D Demo">https://godotengine.org/asset-library/asset/583</link>
  15. </tutorials>
  16. <methods>
  17. <method name="Transform2D">
  18. <return type="Transform2D">
  19. </return>
  20. <argument index="0" name="from" type="Transform">
  21. </argument>
  22. <description>
  23. Constructs the transform from a 3D [Transform].
  24. </description>
  25. </method>
  26. <method name="Transform2D">
  27. <return type="Transform2D">
  28. </return>
  29. <argument index="0" name="x_axis" type="Vector2">
  30. </argument>
  31. <argument index="1" name="y_axis" type="Vector2">
  32. </argument>
  33. <argument index="2" name="origin" type="Vector2">
  34. </argument>
  35. <description>
  36. Constructs the transform from 3 [Vector2] values representing [member x], [member y], and the [member origin] (the three column vectors).
  37. </description>
  38. </method>
  39. <method name="Transform2D">
  40. <return type="Transform2D">
  41. </return>
  42. <argument index="0" name="rotation" type="float">
  43. </argument>
  44. <argument index="1" name="position" type="Vector2">
  45. </argument>
  46. <description>
  47. Constructs the transform from a given angle (in radians) and position.
  48. </description>
  49. </method>
  50. <method name="affine_inverse">
  51. <return type="Transform2D">
  52. </return>
  53. <description>
  54. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
  55. </description>
  56. </method>
  57. <method name="basis_xform">
  58. <return type="Vector2">
  59. </return>
  60. <argument index="0" name="v" type="Vector2">
  61. </argument>
  62. <description>
  63. Returns a vector transformed (multiplied) by the basis matrix.
  64. This method does not account for translation (the origin vector).
  65. </description>
  66. </method>
  67. <method name="basis_xform_inv">
  68. <return type="Vector2">
  69. </return>
  70. <argument index="0" name="v" type="Vector2">
  71. </argument>
  72. <description>
  73. Returns a vector transformed (multiplied) by the inverse basis matrix.
  74. This method does not account for translation (the origin vector).
  75. </description>
  76. </method>
  77. <method name="get_origin">
  78. <return type="Vector2">
  79. </return>
  80. <description>
  81. Returns the transform's origin (translation).
  82. </description>
  83. </method>
  84. <method name="get_rotation">
  85. <return type="float">
  86. </return>
  87. <description>
  88. Returns the transform's rotation (in radians).
  89. </description>
  90. </method>
  91. <method name="get_scale">
  92. <return type="Vector2">
  93. </return>
  94. <description>
  95. Returns the scale.
  96. </description>
  97. </method>
  98. <method name="interpolate_with">
  99. <return type="Transform2D">
  100. </return>
  101. <argument index="0" name="transform" type="Transform2D">
  102. </argument>
  103. <argument index="1" name="weight" type="float">
  104. </argument>
  105. <description>
  106. Returns a transform interpolated between this transform and another by a given [code]weight[/code] (on the range of 0.0 to 1.0).
  107. </description>
  108. </method>
  109. <method name="inverse">
  110. <return type="Transform2D">
  111. </return>
  112. <description>
  113. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use [method affine_inverse] for transforms with scaling).
  114. </description>
  115. </method>
  116. <method name="is_equal_approx">
  117. <return type="bool">
  118. </return>
  119. <argument index="0" name="transform" type="Transform2D">
  120. </argument>
  121. <description>
  122. Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
  123. </description>
  124. </method>
  125. <method name="orthonormalized">
  126. <return type="Transform2D">
  127. </return>
  128. <description>
  129. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).
  130. </description>
  131. </method>
  132. <method name="rotated">
  133. <return type="Transform2D">
  134. </return>
  135. <argument index="0" name="phi" type="float">
  136. </argument>
  137. <description>
  138. Rotates the transform by the given angle (in radians), using matrix multiplication.
  139. </description>
  140. </method>
  141. <method name="scaled">
  142. <return type="Transform2D">
  143. </return>
  144. <argument index="0" name="scale" type="Vector2">
  145. </argument>
  146. <description>
  147. Scales the transform by the given scale factor, using matrix multiplication.
  148. </description>
  149. </method>
  150. <method name="translated">
  151. <return type="Transform2D">
  152. </return>
  153. <argument index="0" name="offset" type="Vector2">
  154. </argument>
  155. <description>
  156. Translates the transform by the given offset, relative to the transform's basis vectors.
  157. Unlike [method rotated] and [method scaled], this does not use matrix multiplication.
  158. </description>
  159. </method>
  160. <method name="xform">
  161. <return type="Variant">
  162. </return>
  163. <argument index="0" name="v" type="Variant">
  164. </argument>
  165. <description>
  166. Transforms the given [Vector2], [Rect2], or [PoolVector2Array] by this transform.
  167. </description>
  168. </method>
  169. <method name="xform_inv">
  170. <return type="Variant">
  171. </return>
  172. <argument index="0" name="v" type="Variant">
  173. </argument>
  174. <description>
  175. Inverse-transforms the given [Vector2], [Rect2], or [PoolVector2Array] by this transform.
  176. </description>
  177. </method>
  178. </methods>
  179. <members>
  180. <member name="origin" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
  181. The origin vector (column 2, the third column). Equivalent to array index [code]2[/code]. The origin vector represents translation.
  182. </member>
  183. <member name="x" type="Vector2" setter="" getter="" default="Vector2( 1, 0 )">
  184. The basis matrix's X vector (column 0). Equivalent to array index [code]0[/code].
  185. </member>
  186. <member name="y" type="Vector2" setter="" getter="" default="Vector2( 0, 1 )">
  187. The basis matrix's Y vector (column 1). Equivalent to array index [code]1[/code].
  188. </member>
  189. </members>
  190. <constants>
  191. <constant name="IDENTITY" value="Transform2D( 1, 0, 0, 1, 0, 0 )">
  192. The identity [Transform2D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
  193. </constant>
  194. <constant name="FLIP_X" value="Transform2D( -1, 0, 0, 1, 0, 0 )">
  195. The [Transform2D] that will flip something along the X axis.
  196. </constant>
  197. <constant name="FLIP_Y" value="Transform2D( 1, 0, 0, -1, 0, 0 )">
  198. The [Transform2D] that will flip something along the Y axis.
  199. </constant>
  200. </constants>
  201. </class>