NumPy is used only for # integer range-addition and cumulative sums; no floating-point geometry is used.
L = F(45058, 10000) # side of the square M = F(15513, 10000) # both empty borders B = F(9973, 10000) T = F(207107, 500000) KMAX = 180 D = T / KMAX WEIGHT_SCALE = 576 # min weight NGRID = 29 LAST = NGRID - 1 # (i, j, w): every distinct D4 image of grid point (i,j) receives weight w/WEIGHT_SCALE.
# Transform that square to the B-square's (U,V) frame.
h = B * (c + s) / 2 lo, hi = h, L - h corners_xy = [(lo, lo), (hi, lo), (hi, hi), (lo, hi)] return [(c * x + s * y, -s * x + c * y) for x, y in corners_xy] def verify_orientation( c: F, s: F, atoms: list[tuple[F, F, int]], ) -> int: """Return …