2
0

Transform2D.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Transform2D" version="4.0">
  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 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 documentation index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
  12. <link title="Matrices and transforms">https://docs.godotengine.org/en/latest/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. <constructors>
  17. <constructor name="Transform2D">
  18. <return type="Transform2D" />
  19. <description>
  20. Constructs a default-initialized [Transform2D] set to [constant IDENTITY].
  21. </description>
  22. </constructor>
  23. <constructor name="Transform2D">
  24. <return type="Transform2D" />
  25. <argument index="0" name="from" type="Transform2D" />
  26. <description>
  27. Constructs a [Transform2D] as a copy of the given [Transform2D].
  28. </description>
  29. </constructor>
  30. <constructor name="Transform2D">
  31. <return type="Transform2D" />
  32. <argument index="0" name="rotation" type="float" />
  33. <argument index="1" name="position" type="Vector2" />
  34. <description>
  35. Constructs the transform from a given angle (in radians) and position.
  36. </description>
  37. </constructor>
  38. <constructor name="Transform2D">
  39. <return type="Transform2D" />
  40. <argument index="0" name="rotation" type="float" />
  41. <argument index="1" name="scale" type="Vector2" />
  42. <argument index="2" name="skew" type="float" />
  43. <argument index="3" name="position" type="Vector2" />
  44. <description>
  45. Constructs the transform from a given angle (in radians), scale, skew (in radians) and position.
  46. </description>
  47. </constructor>
  48. <constructor name="Transform2D">
  49. <return type="Transform2D" />
  50. <argument index="0" name="x_axis" type="Vector2" />
  51. <argument index="1" name="y_axis" type="Vector2" />
  52. <argument index="2" name="origin" type="Vector2" />
  53. <description>
  54. Constructs the transform from 3 [Vector2] values representing [member x], [member y], and the [member origin] (the three column vectors).
  55. </description>
  56. </constructor>
  57. </constructors>
  58. <methods>
  59. <method name="affine_inverse" qualifiers="const">
  60. <return type="Transform2D" />
  61. <description>
  62. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
  63. </description>
  64. </method>
  65. <method name="basis_xform" qualifiers="const">
  66. <return type="Vector2" />
  67. <argument index="0" name="v" type="Vector2" />
  68. <description>
  69. Returns a vector transformed (multiplied) by the basis matrix.
  70. This method does not account for translation (the origin vector).
  71. </description>
  72. </method>
  73. <method name="basis_xform_inv" qualifiers="const">
  74. <return type="Vector2" />
  75. <argument index="0" name="v" type="Vector2" />
  76. <description>
  77. Returns a vector transformed (multiplied) by the inverse basis matrix.
  78. This method does not account for translation (the origin vector).
  79. </description>
  80. </method>
  81. <method name="get_origin" qualifiers="const">
  82. <return type="Vector2" />
  83. <description>
  84. Returns the transform's origin (translation).
  85. </description>
  86. </method>
  87. <method name="get_rotation" qualifiers="const">
  88. <return type="float" />
  89. <description>
  90. Returns the transform's rotation (in radians).
  91. </description>
  92. </method>
  93. <method name="get_scale" qualifiers="const">
  94. <return type="Vector2" />
  95. <description>
  96. Returns the scale.
  97. </description>
  98. </method>
  99. <method name="get_skew" qualifiers="const">
  100. <return type="float" />
  101. <description>
  102. Returns the transform's skew (in radians).
  103. </description>
  104. </method>
  105. <method name="interpolate_with" qualifiers="const">
  106. <return type="Transform2D" />
  107. <argument index="0" name="xform" type="Transform2D" />
  108. <argument index="1" name="weight" type="float" />
  109. <description>
  110. Returns a transform interpolated between this transform and another by a given [code]weight[/code] (on the range of 0.0 to 1.0).
  111. </description>
  112. </method>
  113. <method name="inverse" qualifiers="const">
  114. <return type="Transform2D" />
  115. <description>
  116. 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).
  117. </description>
  118. </method>
  119. <method name="is_equal_approx" qualifiers="const">
  120. <return type="bool" />
  121. <argument index="0" name="xform" type="Transform2D" />
  122. <description>
  123. Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
  124. </description>
  125. </method>
  126. <method name="looking_at" qualifiers="const">
  127. <return type="Transform2D" />
  128. <argument index="0" name="target" type="Vector2" default="Vector2(0, 0)" />
  129. <description>
  130. Returns a copy of the transform rotated such that it's rotation on the X-axis points towards the [code]target[/code] position.
  131. Operations take place in global space.
  132. </description>
  133. </method>
  134. <method name="orthonormalized" qualifiers="const">
  135. <return type="Transform2D" />
  136. <description>
  137. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).
  138. </description>
  139. </method>
  140. <method name="rotated" qualifiers="const">
  141. <return type="Transform2D" />
  142. <argument index="0" name="phi" type="float" />
  143. <description>
  144. Rotates the transform by the given angle (in radians), using matrix multiplication.
  145. </description>
  146. </method>
  147. <method name="scaled" qualifiers="const">
  148. <return type="Transform2D" />
  149. <argument index="0" name="scale" type="Vector2" />
  150. <description>
  151. Scales the transform by the given scale factor, using matrix multiplication.
  152. </description>
  153. </method>
  154. <method name="set_rotation">
  155. <return type="void" />
  156. <argument index="0" name="rotation" type="float" />
  157. <description>
  158. Sets the transform's rotation (in radians).
  159. </description>
  160. </method>
  161. <method name="set_scale">
  162. <return type="void" />
  163. <argument index="0" name="scale" type="Vector2" />
  164. <description>
  165. Sets the transform's scale.
  166. </description>
  167. </method>
  168. <method name="set_skew">
  169. <return type="void" />
  170. <argument index="0" name="skew" type="float" />
  171. <description>
  172. Sets the transform's skew (in radians).
  173. </description>
  174. </method>
  175. <method name="translated" qualifiers="const">
  176. <return type="Transform2D" />
  177. <argument index="0" name="offset" type="Vector2" />
  178. <description>
  179. Translates the transform by the given offset, relative to the transform's basis vectors.
  180. Unlike [method rotated] and [method scaled], this does not use matrix multiplication.
  181. </description>
  182. </method>
  183. </methods>
  184. <members>
  185. <member name="origin" type="Vector2" setter="" getter="" default="Vector2(0, 0)">
  186. The origin vector (column 2, the third column). Equivalent to array index [code]2[/code]. The origin vector represents translation.
  187. </member>
  188. <member name="x" type="Vector2" setter="" getter="" default="Vector2(1, 0)">
  189. The basis matrix's X vector (column 0). Equivalent to array index [code]0[/code].
  190. </member>
  191. <member name="y" type="Vector2" setter="" getter="" default="Vector2(0, 1)">
  192. The basis matrix's Y vector (column 1). Equivalent to array index [code]1[/code].
  193. </member>
  194. </members>
  195. <constants>
  196. <constant name="IDENTITY" value="Transform2D(1, 0, 0, 1, 0, 0)">
  197. The identity [Transform2D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
  198. </constant>
  199. <constant name="FLIP_X" value="Transform2D(-1, 0, 0, 1, 0, 0)">
  200. The [Transform2D] that will flip something along the X axis.
  201. </constant>
  202. <constant name="FLIP_Y" value="Transform2D(1, 0, 0, -1, 0, 0)">
  203. The [Transform2D] that will flip something along the Y axis.
  204. </constant>
  205. </constants>
  206. <operators>
  207. <operator name="operator !=">
  208. <return type="bool" />
  209. <description>
  210. </description>
  211. </operator>
  212. <operator name="operator !=">
  213. <return type="bool" />
  214. <argument index="0" name="right" type="Transform2D" />
  215. <description>
  216. </description>
  217. </operator>
  218. <operator name="operator *">
  219. <return type="PackedVector2Array" />
  220. <argument index="0" name="right" type="PackedVector2Array" />
  221. <description>
  222. </description>
  223. </operator>
  224. <operator name="operator *">
  225. <return type="Transform2D" />
  226. <argument index="0" name="right" type="Transform2D" />
  227. <description>
  228. </description>
  229. </operator>
  230. <operator name="operator *">
  231. <return type="Rect2" />
  232. <argument index="0" name="right" type="Rect2" />
  233. <description>
  234. </description>
  235. </operator>
  236. <operator name="operator *">
  237. <return type="Vector2" />
  238. <argument index="0" name="right" type="Vector2" />
  239. <description>
  240. </description>
  241. </operator>
  242. <operator name="operator *">
  243. <return type="Transform2D" />
  244. <argument index="0" name="right" type="float" />
  245. <description>
  246. This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly.
  247. </description>
  248. </operator>
  249. <operator name="operator *">
  250. <return type="Transform2D" />
  251. <argument index="0" name="right" type="int" />
  252. <description>
  253. This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly.
  254. </description>
  255. </operator>
  256. <operator name="operator ==">
  257. <return type="bool" />
  258. <description>
  259. </description>
  260. </operator>
  261. <operator name="operator ==">
  262. <return type="bool" />
  263. <argument index="0" name="right" type="Transform2D" />
  264. <description>
  265. </description>
  266. </operator>
  267. <operator name="operator []">
  268. <return type="Vector2" />
  269. <argument index="0" name="index" type="int" />
  270. <description>
  271. </description>
  272. </operator>
  273. </operators>
  274. </class>