feat(astro): apsis radii from orbital elements#403
Merged
Conversation
Add orbit::apoapsis_radius_from_elements(a, e) = a*(1+e) and periapsis_radius_from_elements(a, e) = a*(1-e), the farthest and closest orbital radii (m) from the conic elements. Together they are the forward (a, e) -> apsides direction, completing the apsides<->elements bijection: eccentricity_from_apsides (#372) and semi_major_axis_from_apsides (#378) go apsides -> (e, a); these go (a, e) -> apsides. Guard mirrors semi_latus_rectum_from_elements (a > 0, 0 <= e < 1). Analytic test apsis_radius_from_elements_completes_the_apsides_bijection: (a) worked a=7e6, e=0.1 -> r_a=7.7e6, r_p=6.3e6; (b) double round-trip threading #372 + #378 (non-tautological): the computed apsides recover BOTH e and a; (c) threads semi_latus_rectum_from_elements (#384): the harmonic mean of the apsides is the semi-latus rectum p = a(1-e^2); (d) ordering r_p <= a <= r_a and r_a + r_p = 2a; (e) circular: e=0 -> both apsides collapse to a; (f) Err guards for a<=0, e>=1, non-finite (both fns). Free fns in orbit.rs (reached via valenx_astro::orbit::), no lib.rs change. valenx-astro 222 lib tests (was 221), cargo clippy --all-targets -D warnings clean.
nochallenge
added a commit
that referenced
this pull request
Jun 8, 2026
Add report::mach_from_stagnation_pressure_ratio(p0_over_p, gamma), the Mach number recovered from a measured total-to-static pressure ratio: M = sqrt(2*((p0/p)^((gamma-1)/gamma) - 1)/(gamma - 1)) the inverse of isentropic_stagnation_pressure_ratio -- the SUBSONIC pitot-static (Rayleigh-pitot) airspeed reduction, the most common compressible airspeed measurement. Mirrors the #403 temperature-ratio inverse's sentinel style: returns the at-rest 0.0 (the inverse of the ratio's 1.0 no-rise identity) for non-physical input (non-finite, p0/p < 1, or gamma <= 1). Analytic test mach_from_stagnation_pressure_ratio_inverts_the_ratio: (a) round-trip threading isentropic_stagnation_pressure_ratio (both directions); (b) worked: at M=1, gamma=1.4 the critical ratio p0/p = 1.2^3.5 -> M=1; (c) consistency with the temperature-ratio inverse (#403): for the same Mach, the pressure-ratio and temperature-ratio reductions agree; (d) at rest: p0/p = 1 -> M = 0; (e) 0-sentinel guard for p0/p < 1, gamma <= 1, non-finite. Free fn in report.rs (not re-exported), no lib.rs change. valenx-aero 213 lib tests (was 212), cargo clippy --all-targets -D warnings clean.
nochallenge
added a commit
that referenced
this pull request
Jun 8, 2026
…421) Add report::mach_from_stagnation_density_ratio(rho0_over_rho, gamma), the Mach number recovered from a measured total-to-static density ratio: M = sqrt(2*((rho0/rho)^(gamma-1) - 1)/(gamma - 1)) the inverse of isentropic_stagnation_density_ratio. With the temperature- (#403) and pressure-ratio (#409) inverses it completes the stagnation- ratio inverse trio. Mirrors their sentinel style: returns the at-rest 0.0 (the inverse of the ratio's 1.0 no-compression identity) for non-physical input (non-finite, rho0/rho < 1, or gamma <= 1). Analytic test mach_from_stagnation_density_ratio_inverts_the_ratio: (a) round-trip threading isentropic_stagnation_density_ratio (both directions); (b) worked: at M=1, gamma=1.4 the sonic ratio rho0/rho = 1.2^2.5 -> M=1; (c) consistency with the temperature- and pressure-ratio inverses: for the same Mach all three stagnation-ratio reductions return the same Mach; (d) at rest: rho0/rho = 1 -> M = 0; (e) 0-sentinel guard for rho0/rho < 1, gamma <= 1, non-finite. Free fn in report.rs (not re-exported), no lib.rs change. valenx-aero 214 lib tests (was 213), cargo clippy --all-targets -D warnings clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the apsis-radius pair from orbital elements:
Why
orbit.rshaseccentricity_from_apsides(#372) andsemi_major_axis_from_apsides(#378) — theapsides -> (e, a)inverses — but not the forward direction. These two complete the apsides <-> elements bijection:(a, e) -> apsides. Guard mirrorssemi_latus_rectum_from_elements(a > 0,0 <= e < 1).Test
apsis_radius_from_elements_completes_the_apsides_bijection:a=7e6, e=0.1 -> r_a=7.7e6, r_p=6.3e6;eanda;semi_latus_rectum_from_elements(chore(deps)(deps): bump sha2 from 0.10.9 to 0.11.0 #384) — the harmonic mean of the apsides is the semi-latus rectump = a(1-e^2);r_p <= a <= r_aandr_a + r_p = 2a;e=0 -> both apsides collapse to a;a<=0,e>=1, non-finite (both fns).Free fns in
orbit.rs(reached viavalenx_astro::orbit::), nolib.rschange.valenx-astro222 lib tests (was 221);cargo clippy -p valenx-astro --all-targets -- -D warningsclean. Research-grade two-body primitives.