diff --git a/client/FellaSkin.cs b/client/FellaSkin.cs index fecbebb..b328ee9 100644 --- a/client/FellaSkin.cs +++ b/client/FellaSkin.cs @@ -60,6 +60,23 @@ public partial class FellaSkin : Node3D return worst; } + /// + /// How far the rest pose is from left-right symmetric, in metres: the largest distance from any rest vertex mirrored across x = 0 to the nearest rest vertex. + /// The plan is symmetric about x = 0, so a lopsided build shows here whatever the pose. + /// + public float MirrorGap() + { + float worst = 0f; + foreach (var v in _rest) + { + float nearest = float.MaxValue; + var mirrored = new Vector3(-v.X, v.Y, v.Z); + foreach (var u in _rest) nearest = Math.Min(nearest, mirrored.DistanceTo(u)); + worst = Math.Max(worst, nearest); + } + return worst; + } + public override void _Ready() { var plan = SeatedPuppet.Plan; diff --git a/client/tests/RenderCheck.cs b/client/tests/RenderCheck.cs index f33216f..7f3f1c0 100644 --- a/client/tests/RenderCheck.cs +++ b/client/tests/RenderCheck.cs @@ -22,7 +22,7 @@ public partial class RenderCheck : Node private const double WatchdogSeconds = 120; // Bounds (shipped worst, least claimed mutant, separation) are in each check's comment. private const int OddLevelFloor = 1245, FigureMisses = 1, DitherBlocks = 160; - private const double NeckBound = 1.0, FogLevels = 6.6, LightLevels = 11, MipPercent = 6.5; + private const double SymmetryMillimetres = 85, NeckBound = 1.14, FogLevels = 6.6, LightLevels = 11, MipPercent = 6.5; private readonly List _failures = new(); private Main _main = null!; @@ -89,6 +89,7 @@ public partial class RenderCheck : Node CheckFigureWhereLanesAre(await Capture("play-clear")); _main.Chamber.Volume.Visible = true; await CheckNeck(); + CheckSymmetry(); var home = _camera.Transform; _camera.Distance = 0.9f; @@ -195,8 +196,8 @@ public partial class RenderCheck : Node /// /// A real neck is drawn. The chamber is hidden and the camera put straight in front of the head, 1.2 m away; the reading is the figure pixels on the row /// 1 cm below the projected neck joint (the torso's pose times the joint's local anchor) over the figure pixels on the row through the projected head origin: - /// how wide the figure is at the neck against how wide at the head. Bound 1.0 = sqrt(0.58 x 1.72): shipped 0.58 (63 px over 108), the least claimed mutant - /// fella-primitives (the primitive box torso, 0.30 m wide, drawn again beside the skin) 1.72 (186 px over 108), separation 3.0; skin-unposed reads 0.54. + /// how wide the figure is at the neck against how wide at the head. Bound 1.14 = sqrt(0.73 x 1.79): shipped 0.73 (66 px over 90), the least claimed mutant + /// fella-primitives (the primitive box torso, 0.30 m wide, drawn again beside the skin) 1.79 (183 px over 102), separation 2.45; skin-unposed reads 0.72. /// private async Task CheckNeck() { @@ -231,6 +232,17 @@ public partial class RenderCheck : Node _main.Chamber.Visible = true; } + /// + /// The rest-pose mesh is left-right symmetric: no rendering, a count of the skin's own vertices (, millimetres). + /// Bound 85 mm = sqrt(55.9 x 128.9): shipped 55.9 mm, the least claimed mutant skin-lopsided (the left half's vertices stretched 1.5 times in x) 128.9 mm, separation 2.3. + /// + private void CheckSymmetry() + { + double gap = _main.Bodies.Skin.MirrorGap() * 1000.0; + Report("symmetry: largest mirror distance of the rest mesh in mm", gap, SymmetryMillimetres); + Check(gap <= SymmetryMillimetres, "symmetry", $"the rest mesh is {gap:0.#} mm from its mirror image at worst (bound {SymmetryMillimetres})"); + } + /// /// The snap and the affine probes: the figure and floor are hidden and a probe is drawn with the client's own material under the client's camera. /// Snap: a box on a 30-line grid (blocks of 24 px), its drawn blocks against the blocks the CPU-projected hull covers with its corners snapped to diff --git a/client/tests/render-mutants.sh b/client/tests/render-mutants.sh index 8b0e058..e0ec629 100644 --- a/client/tests/render-mutants.sh +++ b/client/tests/render-mutants.sh @@ -44,6 +44,7 @@ MUTANTS=( 'glow-unset|Chamber.cs|Look.GlowLightEnergy * glow|0f|glow' 'carrier-unposed|BodyRenderer.cs|node.Transform = new Transform3D(new Basis(new Quaternion(rx[i]|_ = new Transform3D(new Basis(new Quaternion(rx[i]|figure at lanes' 'fella-primitives|BodyRenderer.cs|SeatedPuppet.PartOf(ids[i]) is null && PrimitiveOf(|PrimitiveOf(|neck' +'skin-lopsided|FellaSkin.cs|positions.Add(v[i]);|positions.Add(v[i].X > 0f ? new Vector3(1.5f * v[i].X, v[i].Y, v[i].Z) : v[i]);|symmetry' 'skin-unposed|FellaSkin.cs|is { } pose) _skin[p] = pose * _inverseCreation[p];|is { } pose) _skin[p] = Transform3D.Identity;|figure at lanes' )