2
0

Rect2.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Rect2" version="3.4">
  3. <brief_description>
  4. 2D axis-aligned bounding box.
  5. </brief_description>
  6. <description>
  7. [Rect2] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
  8. It uses floating-point coordinates.
  9. The 3D counterpart to [Rect2] is [AABB].
  10. </description>
  11. <tutorials>
  12. <link title="Math tutorial index">https://docs.godotengine.org/en/3.3/tutorials/math/index.html</link>
  13. <link title="Vector math">https://docs.godotengine.org/en/3.3/tutorials/math/vector_math.html</link>
  14. <link title="Advanced vector math">https://docs.godotengine.org/en/3.3/tutorials/math/vectors_advanced.html</link>
  15. </tutorials>
  16. <methods>
  17. <method name="Rect2">
  18. <return type="Rect2">
  19. </return>
  20. <argument index="0" name="position" type="Vector2">
  21. </argument>
  22. <argument index="1" name="size" type="Vector2">
  23. </argument>
  24. <description>
  25. Constructs a [Rect2] by position and size.
  26. </description>
  27. </method>
  28. <method name="Rect2">
  29. <return type="Rect2">
  30. </return>
  31. <argument index="0" name="x" type="float">
  32. </argument>
  33. <argument index="1" name="y" type="float">
  34. </argument>
  35. <argument index="2" name="width" type="float">
  36. </argument>
  37. <argument index="3" name="height" type="float">
  38. </argument>
  39. <description>
  40. Constructs a [Rect2] by x, y, width, and height.
  41. </description>
  42. </method>
  43. <method name="abs">
  44. <return type="Rect2">
  45. </return>
  46. <description>
  47. Returns a [Rect2] with equivalent position and area, modified so that the top-left corner is the origin and [code]width[/code] and [code]height[/code] are positive.
  48. </description>
  49. </method>
  50. <method name="clip">
  51. <return type="Rect2">
  52. </return>
  53. <argument index="0" name="b" type="Rect2">
  54. </argument>
  55. <description>
  56. Returns the intersection of this [Rect2] and b.
  57. </description>
  58. </method>
  59. <method name="encloses">
  60. <return type="bool">
  61. </return>
  62. <argument index="0" name="b" type="Rect2">
  63. </argument>
  64. <description>
  65. Returns [code]true[/code] if this [Rect2] completely encloses another one.
  66. </description>
  67. </method>
  68. <method name="expand">
  69. <return type="Rect2">
  70. </return>
  71. <argument index="0" name="to" type="Vector2">
  72. </argument>
  73. <description>
  74. Returns this [Rect2] expanded to include a given point.
  75. </description>
  76. </method>
  77. <method name="get_area">
  78. <return type="float">
  79. </return>
  80. <description>
  81. Returns the area of the [Rect2].
  82. </description>
  83. </method>
  84. <method name="grow">
  85. <return type="Rect2">
  86. </return>
  87. <argument index="0" name="by" type="float">
  88. </argument>
  89. <description>
  90. Returns a copy of the [Rect2] grown a given amount of units towards all the sides.
  91. </description>
  92. </method>
  93. <method name="grow_individual">
  94. <return type="Rect2">
  95. </return>
  96. <argument index="0" name="left" type="float">
  97. </argument>
  98. <argument index="1" name="top" type="float">
  99. </argument>
  100. <argument index="2" name="right" type="float">
  101. </argument>
  102. <argument index="3" name=" bottom" type="float">
  103. </argument>
  104. <description>
  105. Returns a copy of the [Rect2] grown a given amount of units towards each direction individually.
  106. </description>
  107. </method>
  108. <method name="grow_margin">
  109. <return type="Rect2">
  110. </return>
  111. <argument index="0" name="margin" type="int">
  112. </argument>
  113. <argument index="1" name="by" type="float">
  114. </argument>
  115. <description>
  116. Returns a copy of the [Rect2] grown a given amount of units towards the [enum Margin] direction.
  117. </description>
  118. </method>
  119. <method name="has_no_area">
  120. <return type="bool">
  121. </return>
  122. <description>
  123. Returns [code]true[/code] if the [Rect2] is flat or empty.
  124. </description>
  125. </method>
  126. <method name="has_point">
  127. <return type="bool">
  128. </return>
  129. <argument index="0" name="point" type="Vector2">
  130. </argument>
  131. <description>
  132. Returns [code]true[/code] if the [Rect2] contains a point.
  133. </description>
  134. </method>
  135. <method name="intersects">
  136. <return type="bool">
  137. </return>
  138. <argument index="0" name="b" type="Rect2">
  139. </argument>
  140. <argument index="1" name="include_borders" type="bool" default="false">
  141. </argument>
  142. <description>
  143. Returns [code]true[/code] if the [Rect2] overlaps with [code]b[/code] (i.e. they have at least one point in common).
  144. If [code]include_borders[/code] is [code]true[/code], they will also be considered overlapping if their borders touch, even without intersection.
  145. </description>
  146. </method>
  147. <method name="is_equal_approx">
  148. <return type="bool">
  149. </return>
  150. <argument index="0" name="rect" type="Rect2">
  151. </argument>
  152. <description>
  153. Returns [code]true[/code] if this [Rect2] and [code]rect[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
  154. </description>
  155. </method>
  156. <method name="merge">
  157. <return type="Rect2">
  158. </return>
  159. <argument index="0" name="b" type="Rect2">
  160. </argument>
  161. <description>
  162. Returns a larger [Rect2] that contains this [Rect2] and [code]b[/code].
  163. </description>
  164. </method>
  165. </methods>
  166. <members>
  167. <member name="end" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
  168. Ending corner. This is calculated as [code]position + size[/code]. Setting this value will change the size.
  169. </member>
  170. <member name="position" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
  171. Beginning corner. Typically has values lower than [member end].
  172. </member>
  173. <member name="size" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
  174. Size from [member position] to [member end]. Typically, all components are positive.
  175. If the size is negative, you can use [method abs] to fix it.
  176. </member>
  177. </members>
  178. <constants>
  179. </constants>
  180. </class>