class_rect2.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Rect2.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Rect2:
  5. Rect2
  6. =====
  7. **Category:** Built-In Types
  8. Brief Description
  9. -----------------
  10. 2D Axis-aligned bounding box.
  11. Properties
  12. ----------
  13. +-------------------------------+------------------------------------------------+
  14. | :ref:`Vector2<class_Vector2>` | :ref:`end<class_Rect2_property_end>` |
  15. +-------------------------------+------------------------------------------------+
  16. | :ref:`Vector2<class_Vector2>` | :ref:`position<class_Rect2_property_position>` |
  17. +-------------------------------+------------------------------------------------+
  18. | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Rect2_property_size>` |
  19. +-------------------------------+------------------------------------------------+
  20. Methods
  21. -------
  22. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Rect2<class_Rect2>` | :ref:`Rect2<class_Rect2_method_Rect2>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Vector2<class_Vector2>` size **)** |
  24. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Rect2<class_Rect2>` | :ref:`Rect2<class_Rect2_method_Rect2>` **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` width, :ref:`float<class_float>` height **)** |
  26. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Rect2<class_Rect2>` | :ref:`abs<class_Rect2_method_abs>` **(** **)** |
  28. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Rect2<class_Rect2>` | :ref:`clip<class_Rect2_method_clip>` **(** :ref:`Rect2<class_Rect2>` b **)** |
  30. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`encloses<class_Rect2_method_encloses>` **(** :ref:`Rect2<class_Rect2>` b **)** |
  32. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Rect2<class_Rect2>` | :ref:`expand<class_Rect2_method_expand>` **(** :ref:`Vector2<class_Vector2>` to **)** |
  34. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`get_area<class_Rect2_method_get_area>` **(** **)** |
  36. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Rect2<class_Rect2>` | :ref:`grow<class_Rect2_method_grow>` **(** :ref:`float<class_float>` by **)** |
  38. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Rect2<class_Rect2>` | :ref:`grow_individual<class_Rect2_method_grow_individual>` **(** :ref:`float<class_float>` left, :ref:`float<class_float>` top, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom **)** |
  40. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Rect2<class_Rect2>` | :ref:`grow_margin<class_Rect2_method_grow_margin>` **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` by **)** |
  42. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`has_no_area<class_Rect2_method_has_no_area>` **(** **)** |
  44. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`has_point<class_Rect2_method_has_point>` **(** :ref:`Vector2<class_Vector2>` point **)** |
  46. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`intersects<class_Rect2_method_intersects>` **(** :ref:`Rect2<class_Rect2>` b **)** |
  48. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Rect2<class_Rect2>` | :ref:`merge<class_Rect2_method_merge>` **(** :ref:`Rect2<class_Rect2>` b **)** |
  50. +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. Description
  52. -----------
  53. Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
  54. Tutorials
  55. ---------
  56. - :doc:`../tutorials/math/index`
  57. Property Descriptions
  58. ---------------------
  59. .. _class_Rect2_property_end:
  60. - :ref:`Vector2<class_Vector2>` **end**
  61. Ending corner.
  62. .. _class_Rect2_property_position:
  63. - :ref:`Vector2<class_Vector2>` **position**
  64. Position (starting corner).
  65. .. _class_Rect2_property_size:
  66. - :ref:`Vector2<class_Vector2>` **size**
  67. Size from position to end.
  68. Method Descriptions
  69. -------------------
  70. .. _class_Rect2_method_Rect2:
  71. - :ref:`Rect2<class_Rect2>` **Rect2** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Vector2<class_Vector2>` size **)**
  72. Constructs a ``Rect2`` by position and size.
  73. - :ref:`Rect2<class_Rect2>` **Rect2** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` width, :ref:`float<class_float>` height **)**
  74. Constructs a ``Rect2`` by x, y, width, and height.
  75. .. _class_Rect2_method_abs:
  76. - :ref:`Rect2<class_Rect2>` **abs** **(** **)**
  77. Returns a ``Rect2`` with equivalent position and area, modified so that the top-left corner is the origin and ``width`` and ``height`` are positive.
  78. .. _class_Rect2_method_clip:
  79. - :ref:`Rect2<class_Rect2>` **clip** **(** :ref:`Rect2<class_Rect2>` b **)**
  80. Returns the intersection of this ``Rect2`` and b.
  81. .. _class_Rect2_method_encloses:
  82. - :ref:`bool<class_bool>` **encloses** **(** :ref:`Rect2<class_Rect2>` b **)**
  83. Returns ``true`` if this ``Rect2`` completely encloses another one.
  84. .. _class_Rect2_method_expand:
  85. - :ref:`Rect2<class_Rect2>` **expand** **(** :ref:`Vector2<class_Vector2>` to **)**
  86. Returns this ``Rect2`` expanded to include a given point.
  87. .. _class_Rect2_method_get_area:
  88. - :ref:`float<class_float>` **get_area** **(** **)**
  89. Returns the area of the ``Rect2``.
  90. .. _class_Rect2_method_grow:
  91. - :ref:`Rect2<class_Rect2>` **grow** **(** :ref:`float<class_float>` by **)**
  92. Returns a copy of the ``Rect2`` grown a given amount of units towards all the sides.
  93. .. _class_Rect2_method_grow_individual:
  94. - :ref:`Rect2<class_Rect2>` **grow_individual** **(** :ref:`float<class_float>` left, :ref:`float<class_float>` top, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom **)**
  95. Returns a copy of the ``Rect2`` grown a given amount of units towards each direction individually.
  96. .. _class_Rect2_method_grow_margin:
  97. - :ref:`Rect2<class_Rect2>` **grow_margin** **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` by **)**
  98. Returns a copy of the ``Rect2`` grown a given amount of units towards the :ref:`Margin<enum_@GlobalScope_Margin>` direction.
  99. .. _class_Rect2_method_has_no_area:
  100. - :ref:`bool<class_bool>` **has_no_area** **(** **)**
  101. Returns ``true`` if the ``Rect2`` is flat or empty.
  102. .. _class_Rect2_method_has_point:
  103. - :ref:`bool<class_bool>` **has_point** **(** :ref:`Vector2<class_Vector2>` point **)**
  104. Returns ``true`` if the ``Rect2`` contains a point.
  105. .. _class_Rect2_method_intersects:
  106. - :ref:`bool<class_bool>` **intersects** **(** :ref:`Rect2<class_Rect2>` b **)**
  107. Returns ``true`` if the ``Rect2`` overlaps with another.
  108. .. _class_Rect2_method_merge:
  109. - :ref:`Rect2<class_Rect2>` **merge** **(** :ref:`Rect2<class_Rect2>` b **)**
  110. Returns a larger Rect2 that contains this Rect2 and ``with``.