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,22 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Chest Opener</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="171.6" y2="123.2"><stop offset="0" stop-color="#515662"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="165.6" y1="123.9" x2="158.6" y2="150.6"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#5c616d"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="150.6" x2="166.1" y2="152.5"><stop offset="0" stop-color="#5c616d"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="173.5" y2="122.7"><stop offset="0" stop-color="#535964"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="168.3" y1="123.3" x2="158.6" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595f6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="149.2" x2="165.8" y2="151.8"><stop offset="0" stop-color="#595f6a"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-arm_l-0" gradientUnits="userSpaceOnUse" x1="164.7" y1="33.3" x2="155.5" y2="51.8"><stop offset="0" stop-color="#81cdc3"/><stop offset="1" stop-color="#86cfc5"/></linearGradient>
<linearGradient id="grad-arm_r-1" gradientUnits="userSpaceOnUse" x1="151.3" y1="53.1" x2="154.2" y2="73.6"><stop offset="0" stop-color="#0d9488"/><stop offset="1" stop-color="#13978b"/></linearGradient>
</defs>
<path d="M 124.9 157.5 L 180.0 157.5 L 180.0 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 124.9 157.5 L 181.9 157.5 L 181.9 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 164.1 92.3 L 171.6 123.2" stroke="url(#grad-leg_l-0)" stroke-width="3.77719" stroke-linecap="round"/>
<path d="M 171.6 123.2 L 161.4 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 148.9 L 168.6 151.6" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 164.1 92.3 L 173.5 122.7" stroke="url(#grad-leg_l-0)" stroke-width="3.77004" stroke-linecap="round"/>
<path d="M 173.5 122.7 L 161.4 147.5" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 147.5 L 168.3 150.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 160.0 92.7 L 165.6 123.9" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 165.6 123.9 L 158.6 150.6" stroke="url(#grad-leg_r-1)" stroke-width="4.09338" stroke-linecap="round"/>
<path d="M 158.6 150.6 L 166.1 152.5" stroke="url(#grad-leg_r-2)" stroke-width="3.96643" stroke-linecap="round"/>
<path d="M 160.0 92.7 L 168.3 123.3" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 168.3 123.3 L 158.6 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10092" stroke-linecap="round"/>
<path d="M 158.6 149.2 L 165.8 151.8" stroke="url(#grad-leg_r-2)" stroke-width="3.97395" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 164.7 33.3 L 155.5 51.8" stroke="url(#grad-arm_l-0)" stroke-width="3.51367" stroke-linecap="round"/>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

@@ -1,22 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Chest Opener</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="171.6" y2="123.2"><stop offset="0" stop-color="#515662"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="165.6" y1="123.9" x2="158.6" y2="150.6"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#5c616d"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="150.6" x2="166.1" y2="152.5"><stop offset="0" stop-color="#5c616d"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="173.5" y2="122.7"><stop offset="0" stop-color="#535964"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="168.3" y1="123.3" x2="158.6" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595f6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="149.2" x2="165.8" y2="151.8"><stop offset="0" stop-color="#595f6a"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-arm_l-0" gradientUnits="userSpaceOnUse" x1="150.8" y1="34.8" x2="147.0" y2="55.2"><stop offset="0" stop-color="#7fccc2"/><stop offset="1" stop-color="#86cfc5"/></linearGradient>
<linearGradient id="grad-arm_r-1" gradientUnits="userSpaceOnUse" x1="145.1" y1="56.7" x2="153.0" y2="75.9"><stop offset="0" stop-color="#0d9488"/><stop offset="1" stop-color="#13978b"/></linearGradient>
</defs>
<path d="M 124.9 157.5 L 180.0 157.5 L 180.0 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 124.9 157.5 L 181.9 157.5 L 181.9 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 164.1 92.3 L 171.6 123.2" stroke="url(#grad-leg_l-0)" stroke-width="3.77719" stroke-linecap="round"/>
<path d="M 171.6 123.2 L 161.4 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 148.9 L 168.6 151.6" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 164.1 92.3 L 173.5 122.7" stroke="url(#grad-leg_l-0)" stroke-width="3.77004" stroke-linecap="round"/>
<path d="M 173.5 122.7 L 161.4 147.5" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 147.5 L 168.3 150.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 160.0 92.7 L 165.6 123.9" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 165.6 123.9 L 158.6 150.6" stroke="url(#grad-leg_r-1)" stroke-width="4.09338" stroke-linecap="round"/>
<path d="M 158.6 150.6 L 166.1 152.5" stroke="url(#grad-leg_r-2)" stroke-width="3.96643" stroke-linecap="round"/>
<path d="M 160.0 92.7 L 168.3 123.3" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 168.3 123.3 L 158.6 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10092" stroke-linecap="round"/>
<path d="M 158.6 149.2 L 165.8 151.8" stroke="url(#grad-leg_r-2)" stroke-width="3.97395" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 150.8 34.8 L 147.0 55.2" stroke="url(#grad-arm_l-0)" stroke-width="3.51883" stroke-linecap="round"/>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

+2 -2
View File
@@ -13,7 +13,7 @@
"shoulder_l": -26, "elbow_l": 34,
"hip_r": 2, "knee_r": 2, "ankle_r": 0,
"hip_l": 2, "knee_l": 2, "ankle_l": 0,
"pins": {"foot_r": [158, 150], "foot_l": [162, 150]}
"pins": {"foot_r": [158, 148], "foot_l": [162, 148]}
},
{
"hold": 2.4, "tween": 1.8,
@@ -24,7 +24,7 @@
"shoulder_l": -55, "elbow_l": 20,
"hip_r": 2, "knee_r": 2, "ankle_r": 0,
"hip_l": 2, "knee_l": 2, "ankle_l": 0,
"pins": {"foot_r": [158, 150], "foot_l": [162, 150],
"pins": {"foot_r": [158, 148], "foot_l": [162, 148],
"hand_r": [150, 41], "hand_l": [154, 42]}
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 201 KiB

+10 -10
View File
@@ -1,22 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
<title>Chest Opener</title>
<defs>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="171.6" y2="123.2"><stop offset="0" stop-color="#515662"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="165.6" y1="123.9" x2="158.6" y2="150.6"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#5c616d"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="150.6" x2="166.1" y2="152.5"><stop offset="0" stop-color="#5c616d"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-leg_l-0" gradientUnits="userSpaceOnUse" x1="164.1" y1="92.3" x2="173.5" y2="122.7"><stop offset="0" stop-color="#535964"/><stop offset="1" stop-color="#a9afba"/></linearGradient>
<linearGradient id="grad-leg_r-1" gradientUnits="userSpaceOnUse" x1="168.3" y1="123.3" x2="158.6" y2="149.2"><stop offset="0" stop-color="#3a3f4b"/><stop offset="1" stop-color="#595f6a"/></linearGradient>
<linearGradient id="grad-leg_r-2" gradientUnits="userSpaceOnUse" x1="158.6" y1="149.2" x2="165.8" y2="151.8"><stop offset="0" stop-color="#595f6a"/><stop offset="1" stop-color="#626873"/></linearGradient>
<linearGradient id="grad-arm_l-0" gradientUnits="userSpaceOnUse" x1="150.8" y1="34.8" x2="147.0" y2="55.2"><stop offset="0" stop-color="#7fccc2"/><stop offset="1" stop-color="#86cfc5"/></linearGradient>
<linearGradient id="grad-arm_r-1" gradientUnits="userSpaceOnUse" x1="145.1" y1="56.7" x2="153.0" y2="75.9"><stop offset="0" stop-color="#0d9488"/><stop offset="1" stop-color="#13978b"/></linearGradient>
</defs>
<path d="M 124.9 157.5 L 180.0 157.5 L 180.0 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<path d="M 124.9 157.5 L 181.9 157.5 L 181.9 150.2 L 124.9 150.2 Z" fill="none" stroke="#b9bec9" stroke-width="2.1" stroke-linejoin="round"/>
<g id="leg_l">
<path d="M 164.1 92.3 L 171.6 123.2" stroke="url(#grad-leg_l-0)" stroke-width="3.77719" stroke-linecap="round"/>
<path d="M 171.6 123.2 L 161.4 148.9" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 148.9 L 168.6 151.6" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 164.1 92.3 L 173.5 122.7" stroke="url(#grad-leg_l-0)" stroke-width="3.77004" stroke-linecap="round"/>
<path d="M 173.5 122.7 L 161.4 147.5" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
<path d="M 161.4 147.5 L 168.3 150.8" stroke="#a9afba" stroke-width="3.5" stroke-linecap="round"/>
</g>
<g id="leg_r">
<path d="M 160.0 92.7 L 165.6 123.9" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 165.6 123.9 L 158.6 150.6" stroke="url(#grad-leg_r-1)" stroke-width="4.09338" stroke-linecap="round"/>
<path d="M 158.6 150.6 L 166.1 152.5" stroke="url(#grad-leg_r-2)" stroke-width="3.96643" stroke-linecap="round"/>
<path d="M 160.0 92.7 L 168.3 123.3" stroke="#3a3f4b" stroke-width="4.2" stroke-linecap="round"/>
<path d="M 168.3 123.3 L 158.6 149.2" stroke="url(#grad-leg_r-1)" stroke-width="4.10092" stroke-linecap="round"/>
<path d="M 158.6 149.2 L 165.8 151.8" stroke="url(#grad-leg_r-2)" stroke-width="3.97395" stroke-linecap="round"/>
</g>
<g id="arm_l">
<path d="M 150.8 34.8 L 147.0 55.2" stroke="url(#grad-arm_l-0)" stroke-width="3.51883" stroke-linecap="round"/>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB