Skip to content

feat(cockpit): add crosswind, pressure altitude, and density altitude calculations - #10

Merged
ATLURI0001 merged 1 commit into
mainfrom
feat/cockpit-crosswind-and-density-altitude-math
Nov 16, 2026
Merged

ATLURI0001 merged 1 commit into
mainfrom
feat/cockpit-crosswind-and-density-altitude-math

Conversation

@ATLURI0001

Copy link
Copy Markdown
Owner

Overview

  • Introduces core flight-physics mathematical models for headwind/crosswind component decomposition, barometric pressure altitude, and International Standard Atmosphere (ISA) density altitude.
  • Enables precise meteorological and landing calculations within HUD indicators and flight management views.

Key Technical Updates

  • Crosswind & Headwind Decomposition (crosswindComponents):
    • Resolves relative wind angle: $\theta = (\text{windDirection} - \text{heading}) \times \frac{\pi}{180}$.
    • Calculates headwindKt = windSpeed * cos(θ) and crosswindKt = windSpeed * sin(θ).
    • Emits normalized zero values to prevent JavaScript -0 IEEE 754 edge cases.
    • Guards against negative wind speeds and non-finite inputs, returning null.
  • Altimetry Models (pressureAltitudeFt, densityAltitudeFt):
    • pressureAltitudeFt: Computes barometric pressure altitude using standard altimeter reference ($29.92126$ inHg): $\text{PA} = \text{alt} + (29.92126 - \text{altimeter}) \times 1000$.
    • densityAltitudeFt: Resolves atmospheric density altitude given pressure altitude and ambient temperature in Celsius: $\text{DA} = \text{PA} + 118.8 \times (T_{\text{ambient}} - T_{\text{ISA}})$, where $T_{\text{ISA}} = 15 - 1.98 \times (\text{PA} / 1000)$.
    • Guards against temperatures below absolute zero ($-273.15^\circ\text{C}$) and non-positive pressure settings.

Verification & Test Results

  • Cockpit Test Suite: node --test src/cockpitMath.test.mjs
  • Test Outcome: 45 / 45 unit tests passed in 124ms
  • Test Coverage:
    • Verified direct headwind (360°/360°), right 90° crosswind (090°/360°), and direct tailwind (180°/360°).
    • Validated pressure altitude shifts across high/low barometric pressure differentials.
    • Validated standard ISA density altitude at sea level (0 ft at 15°C = 0 ft DA) and hot day offsets (+35°C = ~2376 ft DA).

Impact Analysis

  • Pure functional module additions with zero external dependencies and zero regressions across existing HUD rulers or navigational geodesics.

@ATLURI0001
ATLURI0001 merged commit 2396e81 into main Nov 16, 2026
0 of 3 checks passed
@ATLURI0001
ATLURI0001 deleted the feat/cockpit-crosswind-and-density-altitude-math branch November 16, 2026 05:04
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