using System.Numerics; using System.Text.Json; using GamePort.Game; using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-orientation-reference.json"))); int count=0; foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray()) { var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); var current=new Vector3(p[0],p[1],p[2]);var target=new Vector3(p[3],p[4],p[5]); bool dirty=p[9]!=0; for(int i=0;i<(int)p[7];i++) { var before=current;current=JimmyOrientation.Step(current,target,p[6],p[8]!=0,dirty); if(p[8]!=0&&dirty)dirty=before!=target; } Check(Vector3.Distance(current,new(o[0],o[1],o[2]))<.001f,$"{c.GetProperty("name").GetString()}: {current} != {o[0]},{o[1]},{o[2]}");count++; } Check(count==16,"all original orientation cases"); Console.WriteLine("PASS16 copied-original Jimmy facing observations: shortest arcs,180 boundaries, negative normalization, gate retention and repeated settling"); var retained=new Vector3(0,10,0);JimmyOrientation.Step(new(350),retained,1f/60); Check(retained==new Vector3(0,10,0),"step does not mutate destination state"); Console.WriteLine("PASS retained target state remains independent of current Euler"); static void Check(bool ok,string name){if(!ok)throw new Exception(name);}