Transform2D.xml 6.4 KB

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