โš™๏ธrect

__call๏ปฟ

Constructor

Creates a new rectangle.

Arguments

1. Default rectangle (0, 0 position; 0, 0 size).

None.

2. Single value.

Name
Type
Description

value

float

Mins XY, maxs XY value.

3. Single vector.

Name
Type
Description

value

Mins vector, maxs vector.

4. Double value.

Name
Type
Description

x

float

Mins/maxs X coordinate.

y

float

Mins/maxs Y coordinate.

5. Double vector.

Name
Type
Description

mins

Mins vector.

maxs

Maxs vector.

6. Four values.

Name
Type
Description

x0

float

Mins X coordinate.

y0

float

Mins Y coordinate.

x1

float

Maxs X coordinate.

y1

float

Maxs Y coordinate.

Returns

Type
Description

rect

New rectangle.

Example


mins๏ปฟ

Field

Type: vec2

Mins (top-left) vector.


maxs๏ปฟ

Field

Type: vec2

Maxs (bottom-right) vector.


width๏ปฟ

Method

Either returns rectangle's width, or sets a new width.

Arguments

1. Get width.

None.

2. Set width.

Name
Type
Description

value

float

New width.

Returns

1. Get width.

Type
Description

float

Width.

2. Set width.

Type
Description

rect

New rectangle with changed width.

Example


height๏ปฟ

Method

Either returns rectangle's height, or sets a new height.

Arguments

1. Get height.

None.

2. Set height.

Name
Type
Description

value

float

New height.

Returns

1. Get height.

Type
Description

float

Height.

2. Set height.

Type
Description

rect

New rectangle with changed height.

Example


size๏ปฟ

Method

Either returns rectangle's size, or sets a new size.

Arguments

1. Get size.

None.

2. Set size.

Name
Type
Description

value

New size.

Returns

1. Get size.

Type
Description

Size.

2. Set size.

Type
Description

rect

New rectangle with changed size.

Example


explode๏ปฟ

Method

Explodes the rectangle by given vector (increase size from center into all directions by coordinates in the vector).

Arguments

Name
Type
Description

value

Explode size.

Returns

Type
Description

rect

Exploded rectangle.

Example


half_width๏ปฟ

Method

Returns a rectangle with half of the width of this rectangle.

Arguments

None.

Returns

Type
Description

rect

Rectangle with halved width.

Example


translate๏ปฟ

Method

Translates (moves) this rectangle by vector coordinates.

Arguments

Name
Type
Description

value

Translation amount.

Returns

Type
Description

rect

Translated rectangle.

Example


margin_left๏ปฟ

Method

Move rectangle from the left by given amount.

Arguments

Name
Type
Description

value

float

Margin amount.

Returns

Type
Description

rect

Moved rectangle.

Example


margin_right๏ปฟ

Method

Move rectangle from the right by given amount.

Arguments

Name
Type
Description

value

float

Margin amount.

Returns

Type
Description

rect

Moved rectangle.

Example


margin_top๏ปฟ

Method

Move rectangle from the top by given amount.

Arguments

Name
Type
Description

value

float

Margin amount.

Returns

Type
Description

rect

Moved rectangle.

Example


margin_bottom๏ปฟ

Method

Move rectangle from the bottom by given amount.

Arguments

Name
Type
Description

value

float

Margin amount.

Returns

Type
Description

rect

Moved rectangle.

Example


padding_left๏ปฟ

Method

Adds the value to the left side of the rectangle.

Arguments

Name
Type
Description

value

float

Padding amount.

Returns

Type
Description

rect

Resized rectangle.

Example


padding_right๏ปฟ

Method

Adds the value to the right side of the rectangle.

Arguments

Name
Type
Description

value

float

Padding amount.

Returns

Type
Description

rect

Resized rectangle.

Example


padding_top๏ปฟ

Method

Adds the value to the top side of the rectangle.

Arguments

Name
Type
Description

value

float

Padding amount.

Returns

Type
Description

rect

Resized rectangle.

Example


padding_bottom๏ปฟ

Method

Adds the value to the bottom side of the rectangle.

Arguments

Name
Type
Description

value

float

Padding amount.

Returns

Type
Description

rect

Resized rectangle.

Example


shrink๏ปฟ

Method

Shrinks (implodes) the rectangle by given amount.

Arguments

Name
Type
Description

value

float

Shrink value.

Returns

Type
Description

rect

Resized rectangle.

Example


expand๏ปฟ

Method

Expands (explodes) the rectangle by given amount.

Arguments

Name
Type
Description

value

float

Expand value.

Returns

Type
Description

rect

Resized rectangle.

Example


contains๏ปฟ

Method

Returns true if this rectangle contains either vector or another rectangle.

Rectangle overload will return true ONLY of entire other rectangle is within the bounds of this one.

Arguments

1. Vector variant.

Name
Type
Description

other

Vector to check against.

2. Rectangle variant.

Name
Type
Description

other

rect

Rectangle to check against.

Returns

Type
Description

bool

true if other object is in bounds of this rectangle.

Example


overlaps๏ปฟ

Method

Returns true if the other rectangle overlaps with this rectangle.

Arguments

Name
Type
Description

other

rect

Rectangle to check against.

Returns

Type
Description

bool

true if other rectangle overlaps with this rectangle.

Example


intersect๏ปฟ

Method

Intersects this rectangle with another rectangle.

Arguments

Name
Type
Description

other

rect

Rectangle to intersect with.

Returns

Type
Description

rect

Intersected rectangle.

Example


tl๏ปฟ

Method

Returns top-left vector.

Arguments

None.

Returns

Type
Description

Top-left vector.

Example


tr๏ปฟ

Method

Returns top-right vector.

Arguments

None.

Returns

Type
Description

Top-right vector.

Example


br๏ปฟ

Method

Returns bottom-right vector.

Arguments

None.

Returns

Type
Description

Bottom-right vector.

Example


bl๏ปฟ

Method

Returns bottom-left vector.

Arguments

None.

Returns

Type
Description

Bottom-left vector.

Example


center๏ปฟ

Method

Returns center point of this rectangle.

Arguments

None.

Returns

Type
Description

Center point.

Example


circle๏ปฟ

Method

Treats this rectangle as an ellipsis and returns point on it. Note, that this "ellipsis" will be perfect with no modified curvature (basically if this rectangle is a box - you will get a point on a perfect circle).

Arguments

Name
Type
Description

r

float

Radians value.

Returns

Type
Description

Point on the ellipsis.

Example


floor๏ปฟ

Method

Returns floored rectangle.

Arguments

None.

Returns

Type
Description

rect

Floored rectangle.

Example


ceil๏ปฟ

Method

Returns ceiled rectangle.

Arguments

None.

Returns

Type
Description

rect

Ceiled rectangle.

Example


round๏ปฟ

Method

Returns rounded rectangle.

Arguments

None.

Returns

Type
Description

rect

Rounded rectangle.

Example


is_zero๏ปฟ

Method

Returns true if both mins and maxs are equal to 0.

Arguments

None.

Returns

Type
Description

bool

true if this is a zero rectangle.

Example

Last updated