矩形2

类别: 内置类型

简要说明

二维轴对齐的边界框。

属性

Vector2

end

矢量2(0,0)

Vector2

position

矢量2(0,0)

Vector2

size

矢量2(0,0)

方法

Rect2

Rect2 ( Vector2 position, Vector2 size )

Rect2

Rect2 ( float x, float y, float width, float height )

Rect2

abs ( )

Rect2

clip ( Rect2 b )

bool

encloses ( Rect2 b )

Rect2

expand ( Vector2 to )

float

get_area ( )

Rect2

grow ( float by )

Rect2

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

Rect2

grow_margin ( int margin, float by )

bool

has_no_area ( )

bool

has_point ( Vector2 point )

bool

intersects ( Rect2 b )

Rect2

merge ( Rect2 b )

描述

rect2由一个位置、一个大小和几个实用函数组成。它通常用于快速重叠测试。

教程

属性描述

违约

矢量2(0,0)

结束角。

违约

矢量2(0,0)

位置(起始角)。

违约

矢量2(0,0)

从位置到末端的大小。

方法说明

构建一个 Rect2 按位置和大小。

构建一个 Rect2 x,y,宽度和高度。

返回A Rect2 位置和面积相等,修改后左上角为原点 widthheight 是积极的。

返回此的交集 Rect2 和B.

返回 true 如果这样 Rect2 完全包围另一个。

返回此 Rect2 扩展到包含给定点。

返回 Rect2 .

返回的副本 Rect2 向四周生长一定数量的单位。

返回的副本 Rect2 向每个方向分别增长给定数量的单位。

返回的副本 Rect2Margin 方向。

  • bool has_no_area ( )

返回 true 如果 Rect2 是平的还是空的。

返回 true 如果 Rect2 包含一个点。

返回 true 如果 Rect2 与另一个重叠。

返回包含此rect2和 b .