namespace XFEEDToolBox.Core.Galaxy; /// /// Recovered ordinary flat-view lens, separate from catalogue query bounds. /// This is the original GalaxyMapView root-stack configuration and projection /// path, not a claim about runtime HMD, capture, lens-shift or parent overrides. /// See research/galaxy-original-camera-evidence.md for the pinned source chain. /// public static class GalaxyOriginalProjection { public const double StackFieldOfViewDegrees = 56.249000549316406; public const double DegreesToRadians = .01745329238474369; public const double ReferenceAspectRatio = 1.7777777910232544; public const double NearPlane = .10000000149011612; public const double StoredFarPlane = 500000; // 10866E0 multiplies the two original float fields before inheritance. public static readonly double StackFieldOfViewRadians = (float)((float)StackFieldOfViewDegrees * (float)DegreesToRadians); /// /// 2840320 preserves vertical FOV above16:9 and expands it below16:9. /// The original bypasses compensation for HMD or view-flagbit6; callers /// representing those paths must explicitly pass false. Double arithmetic /// ports the formula without claiming native float bit identity. /// public static double VerticalFieldOfView(double aspectRatio, bool compensateNarrowViewport = true) { if (!double.IsFinite(aspectRatio) || aspectRatio <= 0) throw new ArgumentOutOfRangeException(nameof(aspectRatio)); var ratio = compensateNarrowViewport ? Math.Max(1, ReferenceAspectRatio / aspectRatio) : 1; return 2 * Math.Atan(Math.Tan(StackFieldOfViewRadians / 2) * ratio); } /// 4F3150: m11=cot(verticalFov/2), m00=m11/aspect. public static double FocalLength(double width, double height, bool compensateNarrowViewport = true) { if (!double.IsFinite(width) || width <= 0) throw new ArgumentOutOfRangeException(nameof(width)); if (!double.IsFinite(height) || height <= 0) throw new ArgumentOutOfRangeException(nameof(height)); return height / (2 * Math.Tan(VerticalFieldOfView(width / height, compensateNarrowViewport) / 2)); } /// /// Root flagC=1 becomes Camera mode3: infinite reverse depth, near/z. /// StoredFarPlane remains available to other original consumers; it is /// not a finite far clip in this matrix. This method never expands a /// catalogue query or applies a catalogue far clip. /// public static double ReverseDepth(double positiveCameraDepth) { if (!double.IsFinite(positiveCameraDepth) || positiveCameraDepth <= 0) throw new ArgumentOutOfRangeException(nameof(positiveCameraDepth)); return NearPlane / positiveCameraDepth; } }