14 lines
438 B
Python
14 lines
438 B
Python
"""Exact S-bend dimensions for constructive planners."""
|
|
|
|
from math import isqrt
|
|
|
|
|
|
def exact_sbend_spans(radius: int) -> dict[int, int]:
|
|
"""Map lateral offsets to their positive integer spans for a fixed radius."""
|
|
spans = {}
|
|
for offset in range(1, 2 * radius):
|
|
squared = offset * (4 * radius - offset)
|
|
span = isqrt(squared)
|
|
if span * span == squared:
|
|
spans[offset] = span
|
|
return spans
|