fauna: whale rig check bounds from the measured readings, per the margin ruling (whale-rig-s1 fix batch)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-12-01 03:52:25 +01:00
commit e1563fe433

View file

@ -30,9 +30,10 @@ namespace Aetheria.EditorTools
const double Dt = 1.0 / 60;
// Cost bound (lodur:ruling:deterministic-bound-margin): median ms per frame of three Present calls, three whales of 770
// spring joints, Starfire (Ryzen 3 3100, GTX 1070), editor batchmode, 2 substeps a frame. Shipped worst 0.868 (runs: 0.802,
// 0.868), least mutant 7.048 (Burst off; runs: 7.048, 9.321), separation 8.1; bound sqrt(0.868 x 7.048) = 2.47.
const double CostBoundMs = 2.47;
// spring joints, Starfire (Ryzen 3 3100, GTX 1070), editor batchmode, 2 substeps a frame, drawn-pose collision rounds
// included, other agents' load on the machine. Shipped worst 1.79 (runs 1.61, 1.66, 1.79), least mutant 7.05 (Burst off;
// runs 7.05 to 10.96), separation 3.9; bound sqrt(1.79 x 7.05) = 3.55. Before the interpolated pose: shipped 0.78 to 0.87.
const double CostBoundMs = 3.55;
static readonly List<GameObject> Scrap = new List<GameObject>();
static readonly SwimSettings NoSwim = new SwimSettings { PeriodSeconds = 1, Axis = new float3(1, 0, 0) };
@ -166,18 +167,18 @@ namespace Aetheria.EditorTools
return worst <= 1e-3 ? null : $"worst relative segment error {worst}";
}
// Push-out then length again cannot hold a joint exactly on the surface: the rest pull fights the push each substep, so a
// residual remains that grows with stiffness (Soul, readings of the shipped solver: 0.84% at 2, 0.97% at 8, 1.64% at 20,
// 3.92% at 60 of radius + hit radius). Bounds follow lodur:ruling:deterministic-bound-margin: the geometric mean of the
// shipped reading and the least claimed mutant (push-out removed, 100% at every stiffness), except at 8 where a partial
// mutant (Soul m20, 2.8%) is claimed and the bound stays 2%; stiffness 2 -> 9%, 20 -> 13%, 60 -> 20%.
// The drawn pose is pushed out of the colliders and length-held twice, which leaves a residual of 0.13% of radius + hit
// radius at every stiffness from 2 to 60 and 0.18% under a scaled, rotated root (run7; the solver step alone left 0.8% at 2
// up to 3.9% at 60, Soul). Bound per lodur:ruling:deterministic-bound-margin: shipped worst 0.18%, least claimed mutant
// (push-out removed) 100%, bound sqrt(0.0018 x 1.0) = 4%, separation 22 and 25. Mutants that ignore the whale's scale or
// its bone's rotation read 47% and 100%.
static string ColliderPushesOut() =>
ColliderCase(8, 0.02, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(2, 0.09, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(20, 0.13, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(60, 0.20, 1, Quaternion.identity, Vector3.zero)
ColliderCase(8, 0.04, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(2, 0.04, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(20, 0.04, 1, Quaternion.identity, Vector3.zero)
?? ColliderCase(60, 0.04, 1, Quaternion.identity, Vector3.zero)
// A scaled, rotated whale: a collider that ignores the whale's scale or its bone's rotation is far from the tendril.
?? ColliderCase(8, 0.02, 2.2f, Quaternion.Euler(25, 70, 15), new Vector3(4, -3, 9));
?? ColliderCase(8, 0.04, 2.2f, Quaternion.Euler(25, 70, 15), new Vector3(4, -3, 9));
static string ColliderCase(float stiffness, double bound, float scale, Quaternion rootRot, Vector3 rootPos)
{
@ -483,8 +484,9 @@ namespace Aetheria.EditorTools
// A tendril on a body moving steadily trails it by a constant offset; the offset must not beat with the frame rate. At 144 fps
// an un-interpolated pose holds the tail for the frames that owe no step. Bound per lodur:ruling:deterministic-bound-margin:
// shipped worst, least mutant (pose not interpolated: frac forced to 0), separation and the bound are in BeatBound's comment.
const double BeatBound = 1.0;
// shipped worst 1.0e-5 (runs 0.76e-5, 1.0e-5; float32 positions near z = 36), least mutant 1.3e-4 (pose not interpolated: the
// fraction forced to 0), bound sqrt(1.0e-5 x 1.3e-4) = 3.6e-5, separation 3.6 on each side.
const double BeatBound = 3.6e-5;
static string SteadyMotionIsSmooth()
{
var s = new Synth { Gravity = 0, Stiffness = 3, Drag = 0.5f };