Fix figure IK snapping and gate the library on a fail-hard motion checker

Three solver defects made limbs teleport, twist, or windmill: write-back
angles wrapped at ±180 and lerped the long way around; branch flips landed
on configurations the anatomical write-back cannot represent, silently
pulling pinned extremities off their pins; and the degenerate straight-limb
bend plane fell back to the camera axis instead of the anatomical anterior.
solve_limb now verifies each branch reproduces the solved end before
accepting it, resolve unwraps written-back angles toward the pose they
replace, and the degenerate plane comes from the parent's anterior axis.

render.py --check replays every exercise's full tween loop and fails hard
on six invariants (pin fidelity, continuity, wraps, authored-vs-resolved
drift, ground penetration, resolved ROM); --export refuses to ship a
failing exercise. All 66 motions re-authored or retouched to pass: honest
authored angles where pins used to override them silently, grounded feet
on the seated machines, a vertical bench-press bar path, straight-armed
child's pose, a butterfly stretch seated on the mat, and FK arms where
pins forced impossible reaches. MotionSolver.swift mirrors the solver
changes line for line, held by regenerated fixtures.

Claude-Session: https://claude.ai/code/session_01PKptrgbx74peTwHGRxBojv
This commit is contained in:
2026-07-12 00:37:23 -04:00
parent 400601283e
commit 79e75a9127
303 changed files with 3114 additions and 2272 deletions
@@ -1,35 +1,35 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Triceps Pushdown</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="163.7" y2="123.4"><stop offset="0" stop-color="#525763"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#585d69"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#585d69"/><stop offset="1" stop-color="#616772"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="164.7" y2="123.1"><stop offset="0" stop-color="#525863"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595e6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#595e6a"/><stop offset="1" stop-color="#626773"/></linearGradient>
</defs>
<path d="M 141.8 157.5 L 181.6 157.5 L 181.6 150.2 L 141.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 139.8 157.5 L 181.6 157.5 L 181.6 150.2 L 139.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<circle cx="178.2" cy="5.0" r="2.8" fill="#6b7180"/>
<path d="M 178.2 5.0 L 169.8 40.1" stroke="#c5cad4" stroke-width="2.0999999999999996" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M 178.2 5.0 L 169.8 44.2" stroke="#c5cad4" stroke-width="2.0999999999999996" stroke-linecap="round" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 157.1 92.3 L 163.7 123.4" stroke="url(#grad-leg_l-0)" stroke-width="3.77463" stroke-linecap="round"/>
<path d="M 163.7 123.4 L 153.0 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.9 L 160.1 151.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 157.1 92.3 L 164.7 123.1" stroke="url(#grad-leg_l-0)" stroke-width="3.77286" stroke-linecap="round"/>
<path d="M 164.7 123.1 L 153.0 148.2" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.2 L 160.0 151.4" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 153.0 92.7 L 160.4 123.5" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10551" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.98151" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10374" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.97798" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 166.4 34.0 L 153.1 50.0" stroke="#86cfc5" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.1 50.0 L 171.2 39.5" stroke="#86cfc5" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 166.4 34.0 L 150.6 47.5" stroke="#86cfc5" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 150.6 47.5 L 171.2 43.6" stroke="#86cfc5" stroke-width="3.5" stroke-linecap="round"/>
</g>
<path id="girdle" d="M 166.4 34.0 L 162.3 33.9 L 162.3 35.3" stroke="#3a3f4b" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"/>
<path id="pelvisBar" d="M 157.1 92.3 L 153.0 91.8 L 153.0 92.7" stroke="#3a3f4b" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"/>
<path id="spine" d="M 153.0 91.8 Q 156.7 62.0 162.3 33.9" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round" stroke-linejoin="round"/>
<g id="arm_r">
<path d="M 162.3 35.3 L 151.5 53.0" stroke="#0d9488" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 151.5 53.0 L 168.4 40.7" stroke="#0d9488" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 162.3 35.3 L 148.2 50.6" stroke="#0d9488" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 148.2 50.6 L 168.4 44.9" stroke="#0d9488" stroke-width="4.2" stroke-linecap="round"/>
</g>
<path d="M 169.8 38.9 L 169.8 41.3" stroke="#6b7180" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M 169.8 43.0 L 169.8 45.5" stroke="#6b7180" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>
<circle id="head" cx="166.2" cy="20.7" r="7.0" fill="white" stroke="#3a3f4b" stroke-width="4.2"/>
<line id="nose" x1="173.1" y1="21.6" x2="177.9" y2="22.3" stroke="#3a3f4b" stroke-width="2.8" stroke-linecap="round"/>
<g font-family="-apple-system, Helvetica, sans-serif" font-size="11" fill="#6b7180">

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@@ -1,24 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Triceps Pushdown</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="163.7" y2="123.4"><stop offset="0" stop-color="#525763"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#585d69"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#585d69"/><stop offset="1" stop-color="#616772"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="164.7" y2="123.1"><stop offset="0" stop-color="#525863"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595e6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#595e6a"/><stop offset="1" stop-color="#626773"/></linearGradient>
<linearGradient id="grad-arm_l-0" gradientUnits="userSpaceOnUse" x1="166.4" y1="34.0" x2="162.1" y2="54.2"><stop offset="0" stop-color="#7fccc2"/><stop offset="1" stop-color="#86cfc5"/></linearGradient>
<linearGradient id="grad-arm_r-1" gradientUnits="userSpaceOnUse" x1="158.8" y1="55.7" x2="165.6" y2="75.2"><stop offset="0" stop-color="#0d9488"/><stop offset="1" stop-color="#13978b"/></linearGradient>
</defs>
<path d="M 141.8 157.5 L 181.6 157.5 L 181.6 150.2 L 141.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 139.8 157.5 L 181.6 157.5 L 181.6 150.2 L 139.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<circle cx="178.2" cy="5.0" r="2.8" fill="#6b7180"/>
<path d="M 178.2 5.0 L 167.0 74.6" stroke="#c5cad4" stroke-width="2.0999999999999996" stroke-linecap="round" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 157.1 92.3 L 163.7 123.4" stroke="url(#grad-leg_l-0)" stroke-width="3.77463" stroke-linecap="round"/>
<path d="M 163.7 123.4 L 153.0 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.9 L 160.1 151.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 157.1 92.3 L 164.7 123.1" stroke="url(#grad-leg_l-0)" stroke-width="3.77286" stroke-linecap="round"/>
<path d="M 164.7 123.1 L 153.0 148.2" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.2 L 160.0 151.4" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 153.0 92.7 L 160.4 123.5" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10551" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.98151" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10374" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.97798" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 166.4 34.0 L 162.1 54.2" stroke="url(#grad-arm_l-0)" stroke-width="3.51958" stroke-linecap="round"/>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

@@ -16,12 +16,12 @@
"root": {"pos": [150, 66], "pitch": 8},
"spine": [0, 2],
"neck": 6, "head": -8,
"shoulder_r": 15, "elbow_r": 130,
"shoulder_l": 15, "elbow_l": 130,
"shoulder_r": -32, "elbow_r": 148,
"shoulder_l": -39, "elbow_l": 150,
"hip_r": 6, "knee_r": 5, "ankle_r": 0,
"hip_l": 6, "knee_l": 5, "ankle_l": 0,
"pins": {"foot_r": [146, 148], "foot_l": [150, 150],
"hand_r": [172, -10], "hand_l": [176, -8]}
"pins": {"foot_r": [146, 148], "foot_l": [150, 149],
"hand_r": [172, -4], "hand_l": [176, -2]}
},
{
"hold": 0.4, "tween": 1.1,
@@ -32,7 +32,7 @@
"shoulder_l": 8, "elbow_l": 10,
"hip_r": 6, "knee_r": 5, "ankle_r": 0,
"hip_l": 6, "knee_l": 5, "ankle_l": 0,
"pins": {"foot_r": [146, 148], "foot_l": [150, 150],
"pins": {"foot_r": [146, 148], "foot_l": [150, 149],
"hand_r": [168, 40], "hand_l": [172, 42]}
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 125 KiB

+9 -9
View File
@@ -1,24 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Triceps Pushdown</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="163.7" y2="123.4"><stop offset="0" stop-color="#525763"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#585d69"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#585d69"/><stop offset="1" stop-color="#616772"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="157.1" y1="92.3" x2="164.7" y2="123.1"><stop offset="0" stop-color="#525863"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="160.4" y1="123.5" x2="150.2" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595e6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="150.2" y1="149.2" x2="157.4" y2="151.9"><stop offset="0" stop-color="#595e6a"/><stop offset="1" stop-color="#626773"/></linearGradient>
<linearGradient id="grad-arm_l-0" gradientUnits="userSpaceOnUse" x1="166.4" y1="34.0" x2="162.1" y2="54.2"><stop offset="0" stop-color="#7fccc2"/><stop offset="1" stop-color="#86cfc5"/></linearGradient>
<linearGradient id="grad-arm_r-1" gradientUnits="userSpaceOnUse" x1="158.8" y1="55.7" x2="165.6" y2="75.2"><stop offset="0" stop-color="#0d9488"/><stop offset="1" stop-color="#13978b"/></linearGradient>
</defs>
<path d="M 141.8 157.5 L 181.6 157.5 L 181.6 150.2 L 141.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 139.8 157.5 L 181.6 157.5 L 181.6 150.2 L 139.8 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<circle cx="178.2" cy="5.0" r="2.8" fill="#6b7180"/>
<path d="M 178.2 5.0 L 167.0 74.6" stroke="#c5cad4" stroke-width="2.0999999999999996" stroke-linecap="round" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 157.1 92.3 L 163.7 123.4" stroke="url(#grad-leg_l-0)" stroke-width="3.77463" stroke-linecap="round"/>
<path d="M 163.7 123.4 L 153.0 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.9 L 160.1 151.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 157.1 92.3 L 164.7 123.1" stroke="url(#grad-leg_l-0)" stroke-width="3.77286" stroke-linecap="round"/>
<path d="M 164.7 123.1 L 153.0 148.2" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 153.0 148.2 L 160.0 151.4" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 153.0 92.7 L 160.4 123.5" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10551" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.98151" stroke-linecap="round"/>
<path d="M 160.4 123.5 L 150.2 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10374" stroke-linecap="round"/>
<path d="M 150.2 149.2 L 157.4 151.9" stroke="url(#grad-leg_r-2)" stroke-width="3.97798" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 166.4 34.0 L 162.1 54.2" stroke="url(#grad-arm_l-0)" stroke-width="3.51958" stroke-linecap="round"/>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB