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
@@ -8,8 +8,8 @@
<path d="M 50.0 122.0 L 88.0 122.0 L 88.0 122.0 L 50.0 122.0 Z" fill="#c5cad4" stroke="#c5cad4" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M 68.0 127.0 L 68.0 150.0" stroke="#c5cad4" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<g id="arm_l">
<path d="M 75.2 110.3 L 105.1 108.2" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 105.1 108.2 L 125.0 86.1" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 75.2 110.3 L 98.1 129.3" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 98.1 129.3 L 128.0 127.2" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
</g>
<g id="leg_l">
<path d="M 155.9 136.8 L 193.4 110.6" stroke="url(#grad-leg_l-0)" stroke-width="5.08861" stroke-linecap="round"/>
@@ -25,12 +25,12 @@
<path d="M 203.0 148.0 L 212.8 143.1" stroke="#0d9488" stroke-width="6" stroke-linecap="round"/>
</g>
<g id="arm_r">
<path d="M 69.3 112.1 L 99.3 112.3" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 99.3 112.3 L 124.2 96.0" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 69.3 112.1 L 94.0 128.8" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 94.0 128.8 L 124.0 129.0" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
</g>
<path d="M 124.6 86.5 L 124.6 95.5" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="124.6" cy="86.5" r="13" fill="#6b7180"/>
<circle cx="124.6" cy="95.5" r="13" fill="#6b7180"/>
<path d="M 126.0 123.6 L 126.0 132.7" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="126.0" cy="123.6" r="13" fill="#6b7180"/>
<circle cx="126.0" cy="132.7" r="13" fill="#6b7180"/>
<circle id="head" cx="60.2" cy="92.7" r="10" fill="white" stroke="#3a3f4b" stroke-width="6"/>
<line id="nose" x1="68.8" y1="87.6" x2="74.8" y2="84.0" stroke="#3a3f4b" stroke-width="4" 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

@@ -10,8 +10,8 @@
<path d="M 50.0 122.0 L 88.0 122.0 L 88.0 122.0 L 50.0 122.0 Z" fill="#c5cad4" stroke="#c5cad4" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M 68.0 127.0 L 68.0 150.0" stroke="#c5cad4" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<g id="arm_l">
<path d="M 73.0 111.2 L 101.5 102.0" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 101.5 102.0 L 119.0 78.0" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 73.0 111.2 L 101.5 120.3" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 101.5 120.3 L 130.0 111.1" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
</g>
<g id="leg_l">
<path d="M 157.9 114.8 L 203.4 108.1" stroke="url(#grad-leg_l-0)" stroke-width="5.05466" stroke-linecap="round"/>
@@ -27,12 +27,12 @@
<path d="M 203.0 147.7 L 213.7 145.3" stroke="url(#grad-leg_r-2)" stroke-width="5.9661" stroke-linecap="round"/>
</g>
<g id="arm_r">
<path d="M 67.1 113.0 L 96.5 107.4" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 96.5 107.4 L 121.8 91.6" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 67.1 113.0 L 96.5 118.5" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 96.5 118.5 L 126.0 113.0" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
</g>
<path d="M 120.4 80.3 L 120.4 89.3" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="120.4" cy="80.3" r="13" fill="#6b7180"/>
<circle cx="120.4" cy="89.3" r="13" fill="#6b7180"/>
<path d="M 128.0 107.5 L 128.0 116.6" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="128.0" cy="107.5" r="13" fill="#6b7180"/>
<circle cx="128.0" cy="116.6" r="13" fill="#6b7180"/>
<circle id="head" cx="54.5" cy="95.8" r="10" fill="white" stroke="#3a3f4b" stroke-width="6"/>
<line id="nose" x1="61.8" y1="89.0" x2="67.0" y2="84.3" stroke="#3a3f4b" stroke-width="4" stroke-linecap="round"/>
<g font-family="-apple-system, Helvetica, sans-serif" font-size="11" fill="#6b7180">

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 KiB

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 161 KiB

+7 -7
View File
@@ -10,8 +10,8 @@
<path d="M 50.0 122.0 L 88.0 122.0 L 88.0 122.0 L 50.0 122.0 Z" fill="#c5cad4" stroke="#c5cad4" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M 68.0 127.0 L 68.0 150.0" stroke="#c5cad4" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<g id="arm_l">
<path d="M 73.0 111.2 L 101.5 102.0" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 101.5 102.0 L 119.0 78.0" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 73.0 111.2 L 101.5 120.3" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
<path d="M 101.5 120.3 L 130.0 111.1" stroke="#a9afba" stroke-width="5" stroke-linecap="round"/>
</g>
<g id="leg_l">
<path d="M 157.9 114.8 L 203.4 108.1" stroke="url(#grad-leg_l-0)" stroke-width="5.05466" stroke-linecap="round"/>
@@ -27,12 +27,12 @@
<path d="M 203.0 147.7 L 213.7 145.3" stroke="url(#grad-leg_r-2)" stroke-width="5.9661" stroke-linecap="round"/>
</g>
<g id="arm_r">
<path d="M 67.1 113.0 L 96.5 107.4" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 96.5 107.4 L 121.8 91.6" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 67.1 113.0 L 96.5 118.5" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
<path d="M 96.5 118.5 L 126.0 113.0" stroke="#3a3f4b" stroke-width="6" stroke-linecap="round"/>
</g>
<path d="M 120.4 80.3 L 120.4 89.3" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="120.4" cy="80.3" r="13" fill="#6b7180"/>
<circle cx="120.4" cy="89.3" r="13" fill="#6b7180"/>
<path d="M 128.0 107.5 L 128.0 116.6" stroke="#6b7180" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="128.0" cy="107.5" r="13" fill="#6b7180"/>
<circle cx="128.0" cy="116.6" r="13" fill="#6b7180"/>
<circle id="head" cx="54.5" cy="95.8" r="10" fill="white" stroke="#3a3f4b" stroke-width="6"/>
<line id="nose" x1="61.8" y1="89.0" x2="67.0" y2="84.3" stroke="#3a3f4b" stroke-width="4" stroke-linecap="round"/>
<g font-family="-apple-system, Helvetica, sans-serif" font-size="11" fill="#6b7180">

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB