Pular para o conteúdo principal

raygeo.geo.shape.rect

Rectangle intersection and containment tests.

Provides functions to test whether two axis-aligned rectangles intersect and whether one rectangle fully contains another.

Functions

do_rects_intersect()

do_rects_intersect(r1: Rect, r2: Rect) -> bool

Check if two rectangles intersect.

Returns: True if the rectangles intersect.

ParameterTypeDescription
r1RectFirst rectangle (x_min, y_min, x_max, y_max).
r2RectSecond rectangle (x_min, y_min, x_max, y_max).
Returnsbool

does_rect_contain_rect()

does_rect_contain_rect(outer: Rect, inner: Rect) -> bool

Check if one rectangle contains another.

Returns: True if outer fully contains inner.

ParameterTypeDescription
outerRectOuter rectangle (x_min, y_min, x_max, y_max).
innerRectInner rectangle (x_min, y_min, x_max, y_max).
Returnsbool

does_rect_intersect_rect()

does_rect_intersect_rect(r1: Rect, r2: Rect) -> bool

Check if two rectangles intersect.

Returns: True if the rectangles intersect.

ParameterTypeDescription
r1RectFirst rectangle (x_min, y_min, x_max, y_max).
r2RectSecond rectangle (x_min, y_min, x_max, y_max).
Returnsbool

is_point_inside_rect()

is_point_inside_rect(point: Point, rect: Rect) -> bool

Check if a point is inside a rectangle.

Returns: True if the point is inside the rectangle.

ParameterTypeDescription
pointPointPoint (x, y) to test.
rectRectRectangle (x_min, y_min, x_max, y_max).
Returnsbool