class_rect2.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Rect2:
  4. Rect2
  5. =====
  6. **Category:** Built-In Types
  7. Brief Description
  8. -----------------
  9. 2D Axis-aligned bounding box.
  10. Member Functions
  11. ----------------
  12. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  13. | :ref:`Rect2<class_rect2>` | :ref:`Rect2<class_Rect2_Rect2>` **(** :ref:`Vector2<class_vector2>` pos, :ref:`Vector2<class_vector2>` size **)** |
  14. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Rect2<class_rect2>` | :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 **)** |
  16. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Rect2<class_rect2>` | :ref:`clip<class_Rect2_clip>` **(** :ref:`Rect2<class_rect2>` b **)** |
  18. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`encloses<class_Rect2_encloses>` **(** :ref:`Rect2<class_rect2>` b **)** |
  20. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Rect2<class_rect2>` | :ref:`expand<class_Rect2_expand>` **(** :ref:`Vector2<class_vector2>` to **)** |
  22. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`get_area<class_Rect2_get_area>` **(** **)** |
  24. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Rect2<class_rect2>` | :ref:`grow<class_Rect2_grow>` **(** :ref:`float<class_float>` by **)** |
  26. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Rect2<class_rect2>` | :ref:`grow_individual<class_Rect2_grow_individual>` **(** :ref:`float<class_float>` left, :ref:`float<class_float>` top, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom **)** |
  28. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Rect2<class_rect2>` | :ref:`grow_margin<class_Rect2_grow_margin>` **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` by **)** |
  30. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`has_no_area<class_Rect2_has_no_area>` **(** **)** |
  32. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`has_point<class_Rect2_has_point>` **(** :ref:`Vector2<class_vector2>` point **)** |
  34. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`intersects<class_Rect2_intersects>` **(** :ref:`Rect2<class_rect2>` b **)** |
  36. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Rect2<class_rect2>` | :ref:`merge<class_Rect2_merge>` **(** :ref:`Rect2<class_rect2>` b **)** |
  38. +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Member Variables
  40. ----------------
  41. - :ref:`Vector2<class_vector2>` **end** - Ending corner.
  42. - :ref:`Vector2<class_vector2>` **pos** - Position (starting corner).
  43. - :ref:`Vector2<class_vector2>` **size** - Size from position to end.
  44. Description
  45. -----------
  46. Rect2 provides an 2D Axis-Aligned Bounding Box. It consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
  47. Member Function Description
  48. ---------------------------
  49. .. _class_Rect2_Rect2:
  50. - :ref:`Rect2<class_rect2>` **Rect2** **(** :ref:`Vector2<class_vector2>` pos, :ref:`Vector2<class_vector2>` size **)**
  51. Construct a :ref:`Rect2<class_rect2>` by position and size.
  52. .. _class_Rect2_Rect2:
  53. - :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 **)**
  54. Construct a :ref:`Rect2<class_rect2>` by x, y, width and height.
  55. .. _class_Rect2_clip:
  56. - :ref:`Rect2<class_rect2>` **clip** **(** :ref:`Rect2<class_rect2>` b **)**
  57. Returns the intersection of this :ref:`Rect2<class_rect2>` and b.
  58. .. _class_Rect2_encloses:
  59. - :ref:`bool<class_bool>` **encloses** **(** :ref:`Rect2<class_rect2>` b **)**
  60. Returns true if this :ref:`Rect2<class_rect2>` completely encloses another one.
  61. .. _class_Rect2_expand:
  62. - :ref:`Rect2<class_rect2>` **expand** **(** :ref:`Vector2<class_vector2>` to **)**
  63. Return this :ref:`Rect2<class_rect2>` expanded to include a given point.
  64. .. _class_Rect2_get_area:
  65. - :ref:`float<class_float>` **get_area** **(** **)**
  66. Get the area of the :ref:`Rect2<class_rect2>`.
  67. .. _class_Rect2_grow:
  68. - :ref:`Rect2<class_rect2>` **grow** **(** :ref:`float<class_float>` by **)**
  69. Return a copy of the :ref:`Rect2<class_rect2>` grown a given amount of units towards all the sides.
  70. .. _class_Rect2_grow_individual:
  71. - :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 **)**
  72. .. _class_Rect2_grow_margin:
  73. - :ref:`Rect2<class_rect2>` **grow_margin** **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` by **)**
  74. .. _class_Rect2_has_no_area:
  75. - :ref:`bool<class_bool>` **has_no_area** **(** **)**
  76. Return true if the :ref:`Rect2<class_rect2>` is flat or empty.
  77. .. _class_Rect2_has_point:
  78. - :ref:`bool<class_bool>` **has_point** **(** :ref:`Vector2<class_vector2>` point **)**
  79. Return true if the :ref:`Rect2<class_rect2>` contains a point.
  80. .. _class_Rect2_intersects:
  81. - :ref:`bool<class_bool>` **intersects** **(** :ref:`Rect2<class_rect2>` b **)**
  82. Return true if the :ref:`Rect2<class_rect2>` overlaps with another.
  83. .. _class_Rect2_merge:
  84. - :ref:`Rect2<class_rect2>` **merge** **(** :ref:`Rect2<class_rect2>` b **)**
  85. Combine this :ref:`Rect2<class_rect2>` with another, a larger one is returned that contains both.