Show earth curvature in contact elevation profile

Terrain elevations now include the earth bulge correction, so the
profile visually humps up in the middle relative to the straight
LOS beam — showing how the curved earth rises into the signal path.
Uses actual k-factor from HRRR refractivity when available, otherwise
standard 4/3. For a 300 km path at k=4/3, the midpoint bulge is
~2,650 m (8,700 ft).
This commit is contained in:
Graham McIntire 2026-04-11 14:52:01 -05:00
parent ab8773acd0
commit 9fea93f59c
3 changed files with 14 additions and 2 deletions

View file

@ -67,10 +67,20 @@ export const ElevationProfile = {
renderChart(data) {
const points = data.points
const distances = points.map(p => p.dist_km * KM2MI)
const elevations = points.map(p => p.elev * M2FT)
const showFresnel = data.freq_mhz >= 1000
// Earth curvature: add bulge to terrain so it curves up in the middle
// relative to the straight LOS beam. bulge(f) = d1*d2 / (2*k*R)
const k = data.k_factor || (4 / 3)
const R = 6371000 // earth radius in meters
const dTotal = (data.dist_km || 0) * 1000
const elevations = points.map((p, i) => {
const f = points.length > 1 ? i / (points.length - 1) : 0
const bulge = (f * dTotal * (1 - f) * dTotal) / (2 * k * R)
return (p.elev + bulge) * M2FT
})
const losLine = points.map(p => p.beam * M2FT)
const fresnelLower = points.map(p => (p.beam - p.r1) * M2FT)
const showFresnel = data.freq_mhz >= 1000
const ducts = (data.ducts || []).map(d => ({
base_ft: d.base_m_msl * M2FT,

View file

@ -89,6 +89,7 @@ defmodule Microwaveprop.Terrain.TerrainAnalysis do
points: points,
diffraction_db: diffraction_db,
verdict: verdict,
k_factor: k,
max_elevation_m: max_elevation_m,
min_clearance_m: min_clearance_m,
obstructed_count: length(obstructed),

View file

@ -1103,6 +1103,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do
end),
freq_mhz: freq_ghz * 1000,
dist_km: dist_km,
k_factor: analysis.k_factor,
fwd_az: fwd_az,
rev_az: rev_az,
fwd_el: fwd_el,