Skip to content

Enter the ballistic coefficient as either G1 or G7 - #4

Merged
zxpower merged 1 commit into
mainfrom
add_g7_bc
Aug 15, 2026
Merged

zxpower merged 1 commit into
mainfrom
add_g7_bc

Conversation

@zxpower

@zxpower zxpower commented Aug 15, 2026 •

Copy link
Copy Markdown
Owner

What

The BC field now accepts whichever model your bullet is published in. Switching the G1 / G7 toggle converts the value in place — the same pattern the MOA/MRAD/cm toggles already use in the turret card — so the number on screen always describes one physical bullet, and the whole app (trajectory table + target card) recalculates against the matching drag curve.

  • 0.243 G7 → click G1 → field becomes 0.479, both tables re-solve. Toggling back returns 0.243 and byte-identical output.
  • A muted line under the field shows the equivalent in the other model (0.243 G7 ≈ 0.479 G1 for the same bullet), updating live as you type the BC, muzzle velocity or temperature.
  • Re-clicking the already-active model is a no-op; an empty BC stays empty rather than becoming NaN.

How the conversion is derived

Equal retardation means Cd_G1(M)/BC_G1 = Cd_G7(M)/BC_G7, so the factor is simply Cd_G1(M) / Cd_G7(M) read off the drag tables the app already ships — no new magic constant. It is evaluated at the bullet's own Mach number, so it tracks the entered muzzle velocity and temperature, and is clamped to Mach 1.5–3.0.

In that band the factor lands between 1.91 and 1.99, matching the ~1.95 measured for modern boat-tails (175 gr SMK: published 0.475 G1 / 0.243 G7 — this converts 0.243 → 0.479). The clamp is load-bearing: through the transonic region the true ratio swings between 1.3 and 2.3, and converting there would produce nonsense.

A converted BC is an approximation of a measured one, and the README says so — if your bullet has a published BC in the model you intend to shoot, type that instead.

Tests

node test.js → 46 passed, 0 failed (8 new): ratio identity against the drag tables, the 1.9–2.0 band across the supersonic range, clamping of subsonic/supersonic/NaN Mach, the published SMK pair, round-trip stability, direction (G1 is always the larger number), same-model and bad-input no-ops, and a check that a converted BC keeps drop at 600 m within a few cm.

Also driven through a stub-DOM harness exercising the real toggle and input wiring, confirming the target card's elevation and windage clicks are unchanged across a G7→G1 switch, that the ratio tracks velocity, and that the hint updates on input.

@zxpower zxpower self-assigned this Aug 15, 2026
@zxpower
zxpower merged commit 6671af0 into main Aug 15, 2026
2 checks passed
@zxpower
zxpower deleted the add_g7_bc branch August 15, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant