Browse Source

Fix test_extreme_eccentricity to skip invalid hyperbolic true anomalies

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
main
cinnaboot 5 months ago
parent
commit
a46291a7e8
  1. 11
      tests/test_extreme_eccentricity.cpp
  2. 8
      tests/test_extreme_eccentricity.toml

11
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;

8
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,

Loading…
Cancel
Save