Rect2

    2D Axis-aligned bounding box.

    Properties

    Rect2 ( position, Vector2 size )
    Rect2 ( x, float y, width, float height )
    abs ( )
    clip ( b )
    bool ( Rect2 b )
    expand ( to )
    float ( )
    Rect2 ( float by )
    grow_individual ( left, float top, right, float bottom )
    grow_margin ( margin, float by )
    has_no_area ( )
    has_point ( point )
    bool ( Rect2 b )
    merge ( b )

    Description

    Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.

    Property Descriptions

    Ending corner.


    • position

    Position (starting corner).


    Size from position to end.


    Constructs a Rect2 by x, y, width, and height.


    • abs ( )

    Returns a Rect2 with equivalent position and area, modified so that the top-left corner is the origin and width and height are positive.


    Returns the intersection of this Rect2 and b.


    Returns if this Rect2 completely encloses another one.


    Returns this Rect2 expanded to include a given point.



    Returns a copy of the Rect2 grown a given amount of units towards all the sides.


    • grow_individual ( float left, top, float right, bottom )

    Returns a copy of the Rect2 grown a given amount of units towards each direction individually.


    Returns a copy of the grown a given amount of units towards the direction.


    • bool has_no_area ( )

    Returns true if the Rect2 is flat or empty.


    Returns true if the Rect2 contains a point.



    Returns a larger Rect2 that contains this Rect2 and b.