From fbc53d5267fdbb6e3257539b99c0c7a280f4b469 Mon Sep 17 00:00:00 2001 From: Reinholds Zviedris Date: Sat, 15 Aug 2026 20:07:57 +0300 Subject: [PATCH] added ability to changed between G1 and G7 --- README.md | 24 +++++++++++++++++++--- index.html | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- test.js | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 86c6ed8..79a05aa 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,24 @@ stability factor (Sg)** — with a warning if the bullet is marginal (< 1.4) or unstable (< 1.0) — and folds **spin drift** (Litz approximation, right/left twist aware) into the wind/drift column. +### G1 / G7 ballistic coefficient + +Enter the BC in whichever model your bullet is published in. Switching the +**G1 / G7** toggle converts the value in place — the same way the MOA/MRAD/cm +toggles work in the turret card — so you keep describing one bullet and the whole +app (trajectory table + target card) recalculates against the matching drag curve. +The line under the field always shows the equivalent in the other model. + +The two BCs are related by equal retardation, `Cd_G1(M)/BC_G1 = Cd_G7(M)/BC_G7`, +so the conversion factor is just `Cd_G1(M) / Cd_G7(M)` read off the drag tables at +your bullet's own Mach number. That factor is clamped to Mach 1.5–3.0, where it +lands between 1.91 and 1.99 — matching the ~1.95 measured for modern boat-tails +(175 gr SMK: 0.475 G1 / 0.243 G7). Outside that band, and especially through the +transonic region, the ratio swings from 1.3 to 2.3 and is not meaningful. + +> A converted BC is an approximation of a *measured* one. If your bullet has a +> published BC in the model you want to shoot, type that instead. + > Note: this is a helper/estimator. Verify against real dope before relying on it. ## Target card @@ -62,10 +80,10 @@ reach is reported as *no solution* rather than silently estimated. ## Tests -`test.js` extracts the app's ` diff --git a/test.js b/test.js index ad0beb3..237fdff 100644 --- a/test.js +++ b/test.js @@ -143,6 +143,46 @@ test('denser air = more drop', () => { assert(thick.y < thin.y); }); +console.log('G1 <-> G7 BC conversion:'); +const M_800 = 800 / (331.3 * Math.sqrt(1 + 15 / 273.15)); // ~2.35 Mach + +test('ratio is Cd_G1/Cd_G7 at the reference Mach', () => + approx(bcRatio(2), interpCd(DRAG_G1, 2) / interpCd(DRAG_G7, 2), 1e-12)); +test('ratio sits in the measured 1.9-2.0 band across the supersonic range', () => { + for (const m of [1.5, 2, 2.35, 3]) { + const r = bcRatio(m); + assert(r > 1.9 && r < 2.0, 'Mach ' + m + ' gave ' + r.toFixed(3)); + } +}); +test('transonic and subsonic Machs are clamped, not trusted', () => { + approx(bcRatio(0.9), bcRatio(BC_MACH_MIN), 1e-12); + approx(bcRatio(9), bcRatio(BC_MACH_MAX), 1e-12); + approx(bcRatio(NaN), bcRatio(2), 1e-12); // no velocity yet -> Mach 2 +}); +test('175gr SMK 0.243 G7 converts near its published 0.475 G1', () => { + approx(convertBc(0.243, 'G7', 'G1', M_800), 0.475, 0.01); +}); +test('conversion round-trips', () => { + const g1 = convertBc(0.243, 'G7', 'G1', M_800); + approx(convertBc(g1, 'G1', 'G7', M_800), 0.243, 0.0005); +}); +test('G1 BC is always the larger number', () => + assert(convertBc(0.3, 'G7', 'G1', M_800) > 0.3 && convertBc(0.3, 'G1', 'G7', M_800) < 0.3)); +test('same model or bad input is left untouched', () => { + assert.strictEqual(convertBc(0.243, 'G7', 'G7', M_800), 0.243); + assert.strictEqual(convertBc(0, 'G7', 'G1', M_800), 0); + assert(isNaN(convertBc(NaN, 'G7', 'G1', M_800))); +}); +test('converted BC keeps the trajectory the same bullet', () => { + const a1 = findZeroAngle({ ...P }); + const g1bc = convertBc(0.243, 'G7', 'G1', M_800); + const Q = { ...P, bc: g1bc, table: DRAG_G1 }; + const asG7 = simulate({ ...P }, a1, [600])[0]; + const asG1 = simulate(Q, findZeroAngle(Q), [600])[0]; + // Different drag curves, so not identical — but within a few cm at 600 m. + approx(asG1.y * 100, asG7.y * 100, 8, 'drop cm at 600 m'); +}); + console.log('target card:'); const TURRET = { clickCm: 0.25, perMark: 4, perTurn: 36 }; const CTX = { p: { ...P }, angle: findZeroAngle({ ...P }), sg: 1.7, massKg: 175 * GRAIN_TO_KG };