.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Rect2.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Rect2: Rect2 ===== **Category:** Built-In Types Brief Description ----------------- 2D Axis-aligned bounding box. Member Functions ---------------- +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`Rect2` **(** :ref:`Vector2` position, :ref:`Vector2` size **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`Rect2` **(** :ref:`float` x, :ref:`float` y, :ref:`float` width, :ref:`float` height **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`abs` **(** **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`clip` **(** :ref:`Rect2` b **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`encloses` **(** :ref:`Rect2` b **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`expand` **(** :ref:`Vector2` to **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_area` **(** **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`grow` **(** :ref:`float` by **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`grow_individual` **(** :ref:`float` left, :ref:`float` top, :ref:`float` right, :ref:`float` bottom **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`grow_margin` **(** :ref:`int` margin, :ref:`float` by **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_no_area` **(** **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_point` **(** :ref:`Vector2` point **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`intersects` **(** :ref:`Rect2` b **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`merge` **(** :ref:`Rect2` b **)** | +----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Member Variables ---------------- .. _class_Rect2_end: - :ref:`Vector2` **end** - Ending corner. .. _class_Rect2_position: - :ref:`Vector2` **position** - Position (starting corner). .. _class_Rect2_size: - :ref:`Vector2` **size** - Size from position to end. Description ----------- Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. Member Function Description --------------------------- .. _class_Rect2_Rect2: - :ref:`Rect2` **Rect2** **(** :ref:`Vector2` position, :ref:`Vector2` size **)** Constructs a ``Rect2`` by position and size. .. _class_Rect2_Rect2: - :ref:`Rect2` **Rect2** **(** :ref:`float` x, :ref:`float` y, :ref:`float` width, :ref:`float` height **)** Constructs a ``Rect2`` by x, y, width, and height. .. _class_Rect2_abs: - :ref:`Rect2` **abs** **(** **)** .. _class_Rect2_clip: - :ref:`Rect2` **clip** **(** :ref:`Rect2` b **)** Returns the intersection of this ``Rect2`` and b. .. _class_Rect2_encloses: - :ref:`bool` **encloses** **(** :ref:`Rect2` b **)** Returns ``true`` if this ``Rect2`` completely encloses another one. .. _class_Rect2_expand: - :ref:`Rect2` **expand** **(** :ref:`Vector2` to **)** Returns this ``Rect2`` expanded to include a given point. .. _class_Rect2_get_area: - :ref:`float` **get_area** **(** **)** Returns the area of the ``Rect2``. .. _class_Rect2_grow: - :ref:`Rect2` **grow** **(** :ref:`float` by **)** Returns a copy of the ``Rect2`` grown a given amount of units towards all the sides. .. _class_Rect2_grow_individual: - :ref:`Rect2` **grow_individual** **(** :ref:`float` left, :ref:`float` top, :ref:`float` right, :ref:`float` bottom **)** Returns a copy of the ``Rect2`` grown a given amount of units towards each direction individually. .. _class_Rect2_grow_margin: - :ref:`Rect2` **grow_margin** **(** :ref:`int` margin, :ref:`float` by **)** Returns a copy of the ``Rect2`` grown a given amount of units towards the Margin direction. .. _class_Rect2_has_no_area: - :ref:`bool` **has_no_area** **(** **)** Returns ``true`` if the ``Rect2`` is flat or empty. .. _class_Rect2_has_point: - :ref:`bool` **has_point** **(** :ref:`Vector2` point **)** Returns ``true`` if the ``Rect2`` contains a point. .. _class_Rect2_intersects: - :ref:`bool` **intersects** **(** :ref:`Rect2` b **)** Returns ``true`` if the ``Rect2`` overlaps with another. .. _class_Rect2_merge: - :ref:`Rect2` **merge** **(** :ref:`Rect2` b **)** Returns a larger Rect2 that contains this Rect2 and ``with``.