FA-70641 / GIS polygon topology / Open access
Area-weighted centroid of a multipolygon with holes: orientation normalisation · case 01
Clockwise parts pull the centroid away instead of toward themselves.
ROOT CAUSE
Every ring is assumed counter-clockwise, so clockwise rings contribute negative area.
VERIFIED REPAIR
At the orientation normalisation step restore `sg = 1.0 if a2 >= 0 else -1.0`, leaving the rest of the model unchanged.
Unsuccessful approach: Only exterior rings are normalised; counter-clockwise holes are still mis-signed.
Case contract
Input: a multipolygon as a list of polygons, each a list of closed rings (exterior first). Ring orientation is arbitrary: every ring contributes its absolute area and matching first moments, exteriors positively and holes negatively. Moments use the shoelace terms (xi + xi+1)*cross/6. If the total area is 0 return None, else the centroid [cx, cy] rounded to 6 decimals.
Why this case matters
Label placement, zonal summaries and map joins use polygon centroids; courtyards and multi-part parcels must pull the centroid correctly.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
polys = x
A = Cx = Cy = 0.0
for rings in polys:
for k, r in enumerate(rings):
a2 = mx = my = 0.0
for p, q in zip(r, r[1:]):
c = p[0] * q[1] - q[0] * p[1]
a2 += c
mx += (p[0] + q[0]) * c
my += (p[1] + q[1]) * c
sg = 1.0
w = 1.0 if k == 0 else -1.0
A += w * sg * a2 / 2
Cx += w * sg * mx / 6
Cy += w * sg * my / 6
if A == 0:
return None
return [round(Cx / A, 6), round(Cy / A, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525])], [('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None)], [('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #1 | [4.5, 4.5] | [5.833333, 5.833333] | Failed |
| regression #2 | [5.206422, 5.206422] | [4.752747, 4.752747] | Failed |
| regression #3 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #4 | [14.461538, 4.846154] | [14.461538, 4.846154] | Passed |
| regression #5 | [-1.0, -1.0] | [3.8, 3.8] | Failed |
| boundary #6 | None | None | Passed |
| regression #8 | [6.182353, 3.005882] | [5.737288, 2.991525] | Failed |
SHA-256 / 77a05841e30407d978bc5ca62d1a45de3c6913d823a7f4e12d519fb4c7a4a9bf
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
polys = x
A = Cx = Cy = 0.0
for rings in polys:
for k, r in enumerate(rings):
a2 = mx = my = 0.0
for p, q in zip(r, r[1:]):
c = p[0] * q[1] - q[0] * p[1]
a2 += c
mx += (p[0] + q[0]) * c
my += (p[1] + q[1]) * c
sg = 1.0 if a2 >= 0 or k > 0 else -1.0
w = 1.0 if k == 0 else -1.0
A += w * sg * a2 / 2
Cx += w * sg * mx / 6
Cy += w * sg * my / 6
if A == 0:
return None
return [round(Cx / A, 6), round(Cy / A, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525])], [('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None)], [('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #1 | [4.5, 4.5] | [5.833333, 5.833333] | Failed |
| regression #2 | [4.752747, 4.752747] | [4.752747, 4.752747] | Passed |
| regression #3 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #4 | [14.461538, 4.846154] | [14.461538, 4.846154] | Passed |
| regression #5 | [3.8, 3.8] | [3.8, 3.8] | Passed |
| boundary #6 | None | None | Passed |
| regression #8 | [6.182353, 3.005882] | [5.737288, 2.991525] | Failed |
SHA-256 / a3716a49984a85a36542c57d3e7412aff889f0d313d1bb368fc5be33cae6a9ed
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
polys = x
A = Cx = Cy = 0.0
for rings in polys:
for k, r in enumerate(rings):
a2 = mx = my = 0.0
for p, q in zip(r, r[1:]):
c = p[0] * q[1] - q[0] * p[1]
a2 += c
mx += (p[0] + q[0]) * c
my += (p[1] + q[1]) * c
sg = 1.0 if a2 >= 0 else -1.0
w = 1.0 if k == 0 else -1.0
A += w * sg * a2 / 2
Cx += w * sg * mx / 6
Cy += w * sg * my / 6
if A == 0:
return None
return [round(Cx / A, 6), round(Cy / A, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525])], [('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None)], [('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('control #7', [[[[0, 0], [9, 0], [0, 6], [0, 0]]]], [3.0, 2.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444]), ('boundary #10', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]], None), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #8', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [1, 3], [3, 3], [3, 1], [1, 1]], [[8, 2], [8, 5], [11, 5], [11, 2], [8, 2]]]], [5.737288, 2.991525]), ('control #11', [[[[1, 1], [7, 2], [6, 8], [2, 6], [1, 1]]]], [4.121212, 4.10303]), ('regression #12', [[[[-6, -6], [0, -6], [0, 0], [-6, 0], [-6, -6]]], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[5, -2], [7, -2], [7, 0], [5, 0], [5, -2]]]], [-1.438776, -2.010204]), ('regression #13', [[[[0, 0], [8, 0], [8, 8], [0, 8], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], [[[0, 10], [2, 10], [2, 12], [0, 12], [0, 10]]]], [3.153846, 3.923077])], [('control #0', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]], [5.0, 5.0]), ('regression #1', [[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], [[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]], [5.833333, 5.833333]), ('regression #2', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[6, 6], [9, 6], [9, 9], [6, 9], [6, 6]]]], [4.752747, 4.752747]), ('regression #3', [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [5.0, 5.0]), ('regression #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]], [[[10, 0], [20, 0], [20, 10], [10, 10], [10, 0]]]], [14.461538, 4.846154]), ('regression #5', [[[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]]], [[[10, 10], [10, 12], [12, 12], [12, 10], [10, 10]]]], [3.8, 3.8]), ('boundary #6', [[[[0, 0], [5, 0], [10, 0], [0, 0]]]], None), ('regression #9', [[[[0, 0], [12, 0], [12, 6], [0, 6], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], [[[20, 0], [20, 2], [22, 2], [22, 0], [20, 0]]]], [7.055556, 2.944444])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #1 | [5.833333, 5.833333] | [5.833333, 5.833333] | Passed |
| regression #2 | [4.752747, 4.752747] | [4.752747, 4.752747] | Passed |
| regression #3 | [5.0, 5.0] | [5.0, 5.0] | Passed |
| regression #4 | [14.461538, 4.846154] | [14.461538, 4.846154] | Passed |
| regression #5 | [3.8, 3.8] | [3.8, 3.8] | Passed |
| boundary #6 | None | None | Passed |
| regression #8 | [5.737288, 2.991525] | [5.737288, 2.991525] | Passed |
SHA-256 / d84193dfc2f7edc004db6b65d895284a702384cfdac5bf316c1325a1b2fc5c35
Verification & scope
Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:22.528958+00:00.
Case digest / f3e9db578d71d8f9a3ea55951a895104e3824d78904939ce6519761fea89076b