From c76c7c6ae62d87f42c49272b8c43fedf86153c39 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Wed, 13 Jul 2022 08:25:01 -0400 Subject: [PATCH] add test case for equatorial orbit --- tests/orbit_test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/orbit_test.cpp b/tests/orbit_test.cpp index 5207ed0..1d1a575 100644 --- a/tests/orbit_test.cpp +++ b/tests/orbit_test.cpp @@ -79,6 +79,21 @@ TEST_CASE("state vectors to orbital elements, example 3.1", "[orbits]") REQUIRE_THAT(el.nu, WithinAbs(orbitClampAngle(DEG2RAD(280)), 1)); } +TEST_CASE("elements to state vectors, edge case equatorial orbit", "[orbits]") +{ + double mu = EARTH_GRAVITATIONAL_PARAMETER; + dvec3 r = dvec3(0, -8000, 0); + dvec3 v = dvec3(7.45, 0, 0); + + OrbitalElements el = orbitGetElementsFromStateVectors(r, v, mu); + REQUIRE_THAT(el.a, WithinAbs(9028.776, 1e-3)); + REQUIRE_THAT(el.e, WithinAbs(0.114, 1e-3)); + REQUIRE_THAT(el.iota, WithinAbs(0.0, 1e-3)); + REQUIRE_THAT(el.ohm, WithinAbs(0.0, 1e-3)); + REQUIRE_THAT(el.omega, WithinAbs(-1.571, 1e-3)); + REQUIRE_THAT(el.nu, WithinAbs(0.0, 1e-3)); +} + TEST_CASE("orbital elements to state vectors, example 3.2", "[orbits]") { double a = MOLNIYA_SEMI_MAJOR_AXIS;