class neoscore.core.rect.Rect[source]

Bases: object

A rectangle data class.

The x and y coordinates represent the starting position, typically the top left corner. width and height extend rightward and downward.

The only math operation supported for rects is scalar multiplication, where each field is multiplied by a given number.

x: Unit
y: Unit
width: Unit
height: Unit
classmethod from_def(rect_def: RectDef) Rect[source]
offset(offset: Point) Rect[source]

Translate a rect by a point.

merge(other: Rect) Rect[source]

Find the rect encompassing both self and other.

Note: This assumes width and height in both rects are positive.

__init__(x: Unit, y: Unit, width: Unit, height: Unit) None

A Rect or an init arg tuple for one.

alias of Union[Rect, Tuple[Unit, Unit, Unit, Unit]]