#nullable enable namespace BizHawk.Client.Common { public static class PolarRectConversion { /// radial displacement in range 0..181 (this is not asserted) /// angle (in degrees) in range 0..359 (this is not asserted) /// rectangular (Cartesian) coordinates (x, y). x and/or y may be outside the range -128..127. /// public static (short, short) PolarToRectLookup(ushort r, ushort θ) => (PolarRectConversionData._rθ2x[r, θ], PolarRectConversionData._rθ2y[r, θ]); /// horizontal component of rectangular (Cartesian) coordinates (x, y), in range -128..127 (this is not asserted) /// vertical component, as /// polar coordinates (r, θ) where r is radial displacement in range 0..181 and θ is angle (in degrees) in range 0..359 (from +x towards +y) /// public static (ushort, ushort) RectToPolarLookup(sbyte x, sbyte y) => unchecked((PolarRectConversionData._xy2r[(byte) x, (byte) y], PolarRectConversionData._xy2θ[(byte) x, (byte) y])); } }