pyboxbuilder.paths.longest_inscribed_rectangle

pyboxbuilder.paths.longest_inscribed_rectangle(path: Sequence[tuple[float, float]], min_short_dim: float = 0.0) → tuple[float, float, float, float][source]

Find the inscribed rectangle with the longest span (max(width, length)) in a simple polygon.

Ties are broken by area (width * length), then width.

Parameters:
path: Sequence[tuple[float, float]]

Vertices of the polygon.

min_short_dim: float = 0.0

Minimum required thickness (min(width, length)) for validity.

Returns:

(x, y, width, length) in the polygon’s local frame.