FAILURE MAP
← Case archive

FA-87446 / Collision detection broadphase / Open access

SAH skips the last candidate split position · case 01

Splitting off a single outlier on the far side is never considered.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The loop runs k in range(1, n-1).

THE FAILURE

The loop runs k in range(1, n-1).

Unsuccessful approach: Starting at k=2 skips the first candidate instead.

Case contract

solve(prims): top-down BVH build step. Split axis = larger centroid extent (x on ties). Primitives sorted by centroid on that axis (index tiebreak). Cost of split k = 1 + (P(L)*k + P(R)*(n-k))/P(parent) with P the box perimeter of the primitives' bounds; leaf cost n. Return [best k or 0 for leaf, axis, cost rounded to 6, sorted left indices].

Why this case matters

Broadphase stages decide which object pairs ever reach narrowphase; a wrong boundary, ordering or bookkeeping rule silently drops real contacts or floods the solver with false candidates.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(prims):
    n = len(prims)
    cent = [((p[0] + p[2]) / 2, (p[1] + p[3]) / 2) for p in prims]
    ex = max(c[0] for c in cent) - min(c[0] for c in cent)
    ey = max(c[1] for c in cent) - min(c[1] for c in cent)
    axis = 0 if ex >= ey else 1
    order = sorted(range(n), key=lambda i: (cent[i][axis], i))
    def box(ids):
        return [min(prims[i][0] for i in ids), min(prims[i][1] for i in ids), max(prims[i][2] for i in ids), max(prims[i][3] for i in ids)]
    def perim(b):
        return 2 * ((b[2] - b[0]) + (b[3] - b[1]))
    pa = perim(box(order))
    best_k, best = 0, float(n)
    for k in range(1, n - 1):
        cost = 1 + (perim(box(order[:k])) * k + perim(box(order[k:])) * (n - k)) / pa
        if cost < best:
            best_k, best = k, cost
    return [best_k, axis, round(best, 6), sorted(order[:best_k])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[7, 6, 12, 8], [6, 7, 13, 10], [3, 6, 8, 10], [1, 2, 2, 4]]], [1, 0, 3.25, [3]]], [[[[5, 4, 6, 7], [8, 9, 14, 15], [5, 0, 7, 2], [7, 6, 8, 9]]], [3, 1, 3.0, [0, 2, 3]]], [[[[9, 5, 12, 11], [10, 8, 17, 13], [3, 8, 8, 15], [10, 6, 15, 10], [8, 5, 11, 11], [8, 3, 11, 5]]], [1, 0, 5.115385, [2]]], [[[[0, 7, 6, 9], [10, 2, 14, 6]]], [1, 0, 1.761905, [0]]], [[[[3, 5, 4, 8], [0, 1, 4, 8], [3, 6, 9, 11], [4, 1, 8, 3], [10, 3, 17, 7]]], [4, 0, 4.222222, [0, 1, 2, 3]]], [[[[10, 3, 13, 6], [4, 9, 7, 15]]], [1, 1, 1.714286, [0]]], [[[[4, 5, 6, 7], [9, 7, 15, 11], [3, 7, 5, 14]]], [2, 0, 2.619048, [0, 2]]], [[[[3, 5, 5, 12], [7, 1, 11, 2], [0, 10, 6, 16]]], [1, 1, 2.5, [1]]]], [[[[[8, 9, 12, 16], [4, 0, 10, 3], [6, 3, 10, 5], [0, 3, 6, 7], [7, 0, 13, 7]]], [4, 1, 4.137931, [1, 2, 3, 4]]], [[[[8, 3, 10, 6], [1, 0, 2, 4]]], [1, 0, 1.666667, [1]]], [[[[0, 0, 6, 2], [2, 10, 5, 16]]], [1, 1, 1.772727, [0]]], [[[[1, 2, 7, 4], [7, 2, 10, 9], [0, 0, 3, 4], [6, 10, 10, 11], [1, 0, 5, 4], [3, 4, 5, 10], [7, 9, 12, 15]]], [3, 1, 5.481481, [0, 2, 4]]], [[[[2, 9, 7, 12], [5, 10, 9, 12], [0, 9, 4, 10]]], [0, 0, 3.0, []]], [[[[4, 9, 8, 10], [2, 5, 7, 7], [2, 9, 3, 10], [9, 10, 10, 17], [4, 7, 8, 8]]], [4, 1, 3.6, [0, 1, 2, 4]]], [[[[8, 5, 12, 10], [9, 8, 15, 15]]], [0, 1, 2.0, []]], [[[[8, 4, 9, 7], [8, 7, 11, 10], [10, 0, 11, 1], [0, 8, 4, 15], [7, 3, 10, 7]]], [4, 1, 3.576923, [0, 1, 2, 4]]]], [[[[[9, 9, 14, 10], [8, 10, 11, 14], [7, 3, 11, 4]]], [1, 1, 2.5, [2]]], [[[[7, 7, 13, 11], [6, 10, 12, 15], [10, 10, 11, 16], [2, 10, 5, 14], [5, 5, 12, 9], [6, 5, 10, 9]]], [1, 0, 5.636364, [3]]], [[[[9, 7, 13, 11], [6, 3, 8, 5]]], [1, 1, 1.8, [1]]], [[[[3, 10, 5, 12], [6, 4, 9, 11], [8, 7, 14, 11], [10, 2, 13, 8], [3, 9, 4, 10], [3, 3, 9, 8]]], [2, 0, 5.285714, [0, 4]]], [[[[6, 4, 13, 11], [2, 7, 9, 8], [6, 5, 12, 6], [6, 10, 13, 15]]], [0, 1, 4.0, []]], [[[[8, 1, 12, 7], [3, 7, 10, 12]]], [0, 1, 2.0, []]], [[[[7, 0, 10, 1], [0, 8, 6, 13]]], [1, 1, 1.652174, [0]]], [[[[2, 1, 7, 3], [2, 3, 3, 9], [2, 1, 8, 8], [7, 4, 10, 5], [1, 9, 5, 16], [2, 2, 9, 8]]], [5, 1, 4.791667, [0, 1, 2, 3, 5]]]], [[[[[1, 5, 7, 6], [9, 5, 11, 9], [0, 7, 1, 10]]], [2, 0, 2.875, [0, 2]]], [[[[9, 5, 16, 9], [3, 2, 10, 4], [7, 8, 8, 12]]], [1, 1, 2.782609, [1]]], [[[[9, 7, 15, 12], [8, 5, 15, 7], [3, 6, 4, 10]]], [1, 0, 2.736842, [2]]], [[[[8, 2, 10, 3], [6, 1, 9, 7], [6, 10, 10, 15], [5, 0, 9, 5], [2, 10, 9, 11], [2, 1, 6, 6], [5, 9, 9, 10]]], [4, 1, 5.434783, [0, 1, 3, 5]]], [[[[3, 8, 6, 12], [9, 5, 16, 12], [2, 10, 3, 14], [2, 6, 6, 13], [10, 3, 14, 8], [7, 9, 12, 16], [7, 8, 10, 15]]], [3, 0, 5.592593, [0, 2, 3]]], [[[[6, 10, 7, 17], [10, 9, 15, 12], [2, 10, 8, 14], [1, 4, 5, 6]]], [2, 0, 3.518519, [2, 3]]], [[[[7, 7, 12, 11], [6, 2, 9, 5], [4, 2, 8, 4], [6, 1, 8, 6], [5, 2, 7, 7]]], [4, 1, 3.944444, [1, 2, 3, 4]]], [[[[8, 4, 11, 8], [1, 9, 5, 10], [1, 3, 6, 6]]], [2, 0, 2.823529, [1, 2]]]], [[[[[0, 6, 2, 8], [1, 3, 5, 10], [7, 1, 12, 4], [3, 10, 10, 17], [10, 4, 11, 6], [5, 7, 12, 8], [5, 9, 10, 15]]], [5, 1, 5.821429, [0, 1, 2, 4, 5]]], [[[[1, 8, 3, 11], [10, 1, 12, 3], [3, 5, 5, 6]]], [2, 0, 2.142857, [0, 2]]], [[[[0, 10, 3, 12], [6, 6, 10, 12]]], [1, 0, 1.9375, [0]]], [[[[0, 9, 2, 11], [4, 1, 7, 6]]], [1, 1, 1.705882, [1]]], [[[[2, 0, 8, 4], [10, 6, 14, 8], [9, 6, 15, 8], [7, 7, 10, 12], [9, 6, 15, 8], [8, 6, 9, 13]]], [1, 1, 4.269231, [0]]], [[[[9, 0, 16, 4], [8, 7, 14, 8], [0, 9, 3, 13]]], [1, 0, 2.344828, [2]]], [[[[6, 6, 13, 10], [0, 0, 1, 5], [1, 7, 7, 11]]], [1, 0, 2.666667, [1]]], [[[[0, 10, 4, 12], [4, 4, 11, 8], [2, 10, 4, 12], [1, 8, 8, 15], [0, 8, 1, 14]]], [4, 0, 4.227273, [0, 2, 3, 4]]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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 fixtureActualExpectedOutcome
case 0[1, 0, 3.25, [3]][1, 0, 3.25, [3]]Passed
case 1[2, 1, 3.083333, [0, 2]][3, 1, 3.0, [0, 2, 3]]Failed
case 2[1, 0, 5.115385, [2]][1, 0, 5.115385, [2]]Passed
case 3[0, 0, 2.0, []][1, 0, 1.761905, [0]]Failed
case 4[2, 0, 4.481481, [0, 1]][4, 0, 4.222222, [0, 1, 2, 3]]Failed
case 5[0, 1, 2.0, []][1, 1, 1.714286, [0]]Failed
case 6[0, 0, 3.0, []][2, 0, 2.619048, [0, 2]]Failed
case 7[1, 1, 2.5, [1]][1, 1, 2.5, [1]]Passed

SHA-256 / 90ef3ec43ec06f85de85b093eadc8629ee6e611a2f7df3167597ce7f5f39d7d5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(prims):
    n = len(prims)
    cent = [((p[0] + p[2]) / 2, (p[1] + p[3]) / 2) for p in prims]
    ex = max(c[0] for c in cent) - min(c[0] for c in cent)
    ey = max(c[1] for c in cent) - min(c[1] for c in cent)
    axis = 0 if ex >= ey else 1
    order = sorted(range(n), key=lambda i: (cent[i][axis], i))
    def box(ids):
        return [min(prims[i][0] for i in ids), min(prims[i][1] for i in ids), max(prims[i][2] for i in ids), max(prims[i][3] for i in ids)]
    def perim(b):
        return 2 * ((b[2] - b[0]) + (b[3] - b[1]))
    pa = perim(box(order))
    best_k, best = 0, float(n)
    for k in range(2, n):
        cost = 1 + (perim(box(order[:k])) * k + perim(box(order[k:])) * (n - k)) / pa
        if cost < best:
            best_k, best = k, cost
    return [best_k, axis, round(best, 6), sorted(order[:best_k])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[7, 6, 12, 8], [6, 7, 13, 10], [3, 6, 8, 10], [1, 2, 2, 4]]], [1, 0, 3.25, [3]]], [[[[5, 4, 6, 7], [8, 9, 14, 15], [5, 0, 7, 2], [7, 6, 8, 9]]], [3, 1, 3.0, [0, 2, 3]]], [[[[9, 5, 12, 11], [10, 8, 17, 13], [3, 8, 8, 15], [10, 6, 15, 10], [8, 5, 11, 11], [8, 3, 11, 5]]], [1, 0, 5.115385, [2]]], [[[[0, 7, 6, 9], [10, 2, 14, 6]]], [1, 0, 1.761905, [0]]], [[[[3, 5, 4, 8], [0, 1, 4, 8], [3, 6, 9, 11], [4, 1, 8, 3], [10, 3, 17, 7]]], [4, 0, 4.222222, [0, 1, 2, 3]]], [[[[10, 3, 13, 6], [4, 9, 7, 15]]], [1, 1, 1.714286, [0]]], [[[[4, 5, 6, 7], [9, 7, 15, 11], [3, 7, 5, 14]]], [2, 0, 2.619048, [0, 2]]], [[[[3, 5, 5, 12], [7, 1, 11, 2], [0, 10, 6, 16]]], [1, 1, 2.5, [1]]]], [[[[[8, 9, 12, 16], [4, 0, 10, 3], [6, 3, 10, 5], [0, 3, 6, 7], [7, 0, 13, 7]]], [4, 1, 4.137931, [1, 2, 3, 4]]], [[[[8, 3, 10, 6], [1, 0, 2, 4]]], [1, 0, 1.666667, [1]]], [[[[0, 0, 6, 2], [2, 10, 5, 16]]], [1, 1, 1.772727, [0]]], [[[[1, 2, 7, 4], [7, 2, 10, 9], [0, 0, 3, 4], [6, 10, 10, 11], [1, 0, 5, 4], [3, 4, 5, 10], [7, 9, 12, 15]]], [3, 1, 5.481481, [0, 2, 4]]], [[[[2, 9, 7, 12], [5, 10, 9, 12], [0, 9, 4, 10]]], [0, 0, 3.0, []]], [[[[4, 9, 8, 10], [2, 5, 7, 7], [2, 9, 3, 10], [9, 10, 10, 17], [4, 7, 8, 8]]], [4, 1, 3.6, [0, 1, 2, 4]]], [[[[8, 5, 12, 10], [9, 8, 15, 15]]], [0, 1, 2.0, []]], [[[[8, 4, 9, 7], [8, 7, 11, 10], [10, 0, 11, 1], [0, 8, 4, 15], [7, 3, 10, 7]]], [4, 1, 3.576923, [0, 1, 2, 4]]]], [[[[[9, 9, 14, 10], [8, 10, 11, 14], [7, 3, 11, 4]]], [1, 1, 2.5, [2]]], [[[[7, 7, 13, 11], [6, 10, 12, 15], [10, 10, 11, 16], [2, 10, 5, 14], [5, 5, 12, 9], [6, 5, 10, 9]]], [1, 0, 5.636364, [3]]], [[[[9, 7, 13, 11], [6, 3, 8, 5]]], [1, 1, 1.8, [1]]], [[[[3, 10, 5, 12], [6, 4, 9, 11], [8, 7, 14, 11], [10, 2, 13, 8], [3, 9, 4, 10], [3, 3, 9, 8]]], [2, 0, 5.285714, [0, 4]]], [[[[6, 4, 13, 11], [2, 7, 9, 8], [6, 5, 12, 6], [6, 10, 13, 15]]], [0, 1, 4.0, []]], [[[[8, 1, 12, 7], [3, 7, 10, 12]]], [0, 1, 2.0, []]], [[[[7, 0, 10, 1], [0, 8, 6, 13]]], [1, 1, 1.652174, [0]]], [[[[2, 1, 7, 3], [2, 3, 3, 9], [2, 1, 8, 8], [7, 4, 10, 5], [1, 9, 5, 16], [2, 2, 9, 8]]], [5, 1, 4.791667, [0, 1, 2, 3, 5]]]], [[[[[1, 5, 7, 6], [9, 5, 11, 9], [0, 7, 1, 10]]], [2, 0, 2.875, [0, 2]]], [[[[9, 5, 16, 9], [3, 2, 10, 4], [7, 8, 8, 12]]], [1, 1, 2.782609, [1]]], [[[[9, 7, 15, 12], [8, 5, 15, 7], [3, 6, 4, 10]]], [1, 0, 2.736842, [2]]], [[[[8, 2, 10, 3], [6, 1, 9, 7], [6, 10, 10, 15], [5, 0, 9, 5], [2, 10, 9, 11], [2, 1, 6, 6], [5, 9, 9, 10]]], [4, 1, 5.434783, [0, 1, 3, 5]]], [[[[3, 8, 6, 12], [9, 5, 16, 12], [2, 10, 3, 14], [2, 6, 6, 13], [10, 3, 14, 8], [7, 9, 12, 16], [7, 8, 10, 15]]], [3, 0, 5.592593, [0, 2, 3]]], [[[[6, 10, 7, 17], [10, 9, 15, 12], [2, 10, 8, 14], [1, 4, 5, 6]]], [2, 0, 3.518519, [2, 3]]], [[[[7, 7, 12, 11], [6, 2, 9, 5], [4, 2, 8, 4], [6, 1, 8, 6], [5, 2, 7, 7]]], [4, 1, 3.944444, [1, 2, 3, 4]]], [[[[8, 4, 11, 8], [1, 9, 5, 10], [1, 3, 6, 6]]], [2, 0, 2.823529, [1, 2]]]], [[[[[0, 6, 2, 8], [1, 3, 5, 10], [7, 1, 12, 4], [3, 10, 10, 17], [10, 4, 11, 6], [5, 7, 12, 8], [5, 9, 10, 15]]], [5, 1, 5.821429, [0, 1, 2, 4, 5]]], [[[[1, 8, 3, 11], [10, 1, 12, 3], [3, 5, 5, 6]]], [2, 0, 2.142857, [0, 2]]], [[[[0, 10, 3, 12], [6, 6, 10, 12]]], [1, 0, 1.9375, [0]]], [[[[0, 9, 2, 11], [4, 1, 7, 6]]], [1, 1, 1.705882, [1]]], [[[[2, 0, 8, 4], [10, 6, 14, 8], [9, 6, 15, 8], [7, 7, 10, 12], [9, 6, 15, 8], [8, 6, 9, 13]]], [1, 1, 4.269231, [0]]], [[[[9, 0, 16, 4], [8, 7, 14, 8], [0, 9, 3, 13]]], [1, 0, 2.344828, [2]]], [[[[6, 6, 13, 10], [0, 0, 1, 5], [1, 7, 7, 11]]], [1, 0, 2.666667, [1]]], [[[[0, 10, 4, 12], [4, 4, 11, 8], [2, 10, 4, 12], [1, 8, 8, 15], [0, 8, 1, 14]]], [4, 0, 4.227273, [0, 2, 3, 4]]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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 fixtureActualExpectedOutcome
case 0[2, 0, 3.6, [2, 3]][1, 0, 3.25, [3]]Failed
case 1[3, 1, 3.0, [0, 2, 3]][3, 1, 3.0, [0, 2, 3]]Passed
case 2[3, 0, 5.153846, [2, 4, 5]][1, 0, 5.115385, [2]]Failed
case 3[0, 0, 2.0, []][1, 0, 1.761905, [0]]Failed
case 4[4, 0, 4.222222, [0, 1, 2, 3]][4, 0, 4.222222, [0, 1, 2, 3]]Passed
case 5[0, 1, 2.0, []][1, 1, 1.714286, [0]]Failed
case 6[2, 0, 2.619048, [0, 2]][2, 0, 2.619048, [0, 2]]Passed
case 7[2, 1, 2.923077, [0, 1]][1, 1, 2.5, [1]]Failed

SHA-256 / 257bb14b9596b0147f4e85268f11a40ac2fe18365fb510a6df90fe8c60d70073

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model with stipulated toy conventions; not a production physics engine or spatial index. 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:50:58.952114+00:00.

Case digest / ccdeb7f09ed7dd88e512f50f179e93e91ff78ea2be780101058051b20defc38e