Skip to main content

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: types.Rect, r2: types.Rect) -> bool

Check if two rectangles intersect.

Returns: True if the rectangles intersect.

ParameterTypeDescription
r1types.RectFirst rectangle (x_min, y_min, x_max, y_max).
r2types.RectSecond rectangle (x_min, y_min, x_max, y_max).
Returnsbool

does_rect_contain_rect()

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

Check if one rectangle contains another.

Returns: True if outer fully contains inner.

ParameterTypeDescription
outertypes.RectOuter rectangle (x_min, y_min, x_max, y_max).
innertypes.RectInner rectangle (x_min, y_min, x_max, y_max).
Returnsbool

does_rect_intersect_rect()

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

Check if two rectangles intersect.

Returns: True if the rectangles intersect.

ParameterTypeDescription
r1types.RectFirst rectangle (x_min, y_min, x_max, y_max).
r2types.RectSecond rectangle (x_min, y_min, x_max, y_max).
Returnsbool

is_point_inside_rect()

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

Check if a point is inside a rectangle.

Returns: True if the point is inside the rectangle.

ParameterTypeDescription
pointtypes.PointPoint (x, y) to test.
recttypes.RectRectangle (x_min, y_min, x_max, y_max).
Returnsbool