"""Shared helpers that must stay importable outside Blender and Unreal. Blender-side builders import `bpy` at module scope, so nothing in them can be unit tested. Pure layout arithmetic lives here instead: the builders import it, and `Tools/tests/` imports it without a 3D application. Standard library only. """ from __future__ import annotations def bay_centres(x0, x1, margin=0.9, bay=2.2): """Centres of equal bays across a frontage, inset by `margin` at each end. Used by the façade kit and the retail frontage so both use one rhythm. The count is the span divided by the bay module and rounded, so a 33 m frontage at a 2.2 m module gets 14 bays rather than one bay per 2.2 m of wall with a stub at the end. Returns [] when the margins consume the whole frontage. """ span = (x1 - x0) - 2.0 * margin if span <= 0: return [] count = max(1, int(round(span / bay))) step = span / count return [x0 + margin + step * (i + 0.5) for i in range(count)]