From a46291a7e8e520d4e51263a72a1a8cdd4fadb046 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sat, 31 Jan 2026 11:04:35 -0500 Subject: [PATCH] Fix test_extreme_eccentricity to skip invalid hyperbolic true anomalies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Config changes: - 'Slightly_Hyperbolic': e=1.05, a=-1.3e8 (perigee at 6.5e6 m) - 'Near_Parabolic': e=0.99, a=7.0e8 (perigee at 7e6 m) Test changes: - Added check for hyperbolic orbit anomaly limits (|ν| < arccos(-1/e)) - Skip testing ν=π and 3π/2 when they exceed valid range for e>1 --- tests/test_extreme_eccentricity.cpp | 11 +++++++++++ tests/test_extreme_eccentricity.toml | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/test_extreme_eccentricity.cpp b/tests/test_extreme_eccentricity.cpp index 159a257..c505b5e 100644 --- a/tests/test_extreme_eccentricity.cpp +++ b/tests/test_extreme_eccentricity.cpp @@ -158,6 +158,17 @@ TEST_CASE("Velocity magnitude accuracy for extreme eccentricities", "[extreme][e for (int j = 0; j < 4; j++) { double nu = true_anomalies[j]; + + // For hyperbolic orbits (e > 1), skip invalid true anomalies + // Valid range: |ν| < arccos(-1/e) + if (craft->orbit.eccentricity > 1.0) { + double max_nu = acos(-1.0 / craft->orbit.eccentricity); + if (fabs(nu) >= max_nu) { + INFO(" ν=" << nu << " rad: skipped (exceeds hyperbolic limit ±" << max_nu << " rad)"); + continue; + } + } + craft->orbit.true_anomaly = nu; Vec3 pos; diff --git a/tests/test_extreme_eccentricity.toml b/tests/test_extreme_eccentricity.toml index e2c14ec..cf2de16 100644 --- a/tests/test_extreme_eccentricity.toml +++ b/tests/test_extreme_eccentricity.toml @@ -31,8 +31,8 @@ name = "Near_Parabolic" mass = 1000.0 parent_index = 0 orbit = { - semi_major_axis = 1.0e9, - eccentricity = 0.95, + semi_major_axis = 7.0e8, + eccentricity = 0.99, true_anomaly = 0.0, inclination = 0.0, longitude_of_ascending_node = 0.0, @@ -44,8 +44,8 @@ name = "Slightly_Hyperbolic" mass = 1000.0 parent_index = 0 orbit = { - semi_major_axis = -1.0e7, - eccentricity = 1.5, + semi_major_axis = -1.3e8, + eccentricity = 1.05, true_anomaly = 0.0, inclination = 0.0, longitude_of_ascending_node = 0.0,