summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/maths.h4
-rw-r--r--test/test-environment.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/maths.h b/lib/maths.h
index 018ef0e..3127d3c 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -42,6 +42,10 @@ constexpr auto half_pi {glm::half_pi<float>()};
constexpr auto quarter_pi {half_pi / 2};
constexpr auto pi {glm::pi<float>()};
constexpr auto two_pi {glm::two_pi<float>()};
+constexpr auto degreesToRads = pi / 180.F;
+
+constexpr auto earthMeanRadius = 6371.01F; // In km
+constexpr auto astronomicalUnit = 149597890.F; // In km
template<glm::length_t D>
constexpr inline GlobalPosition<D>
diff --git a/test/test-environment.cpp b/test/test-environment.cpp
index 7b758d1..0d02aa1 100644
--- a/test/test-environment.cpp
+++ b/test/test-environment.cpp
@@ -7,10 +7,6 @@
#include <config/types.h>
#include <maths.h>
-constexpr auto degreesToRads = pi / 180.F;
-constexpr auto dEarthMeanRadius = 6371.01F; // In km
-constexpr auto dAstronomicalUnit = 149597890.F; // In km
-
// Based on the C++ code published at https://www.psa.es/sdg/sunpos.htm
// Linked from https://www.pveducation.org/pvcdrom/properties-of-sunlight/suns-position-to-high-accuracy
Direction2D
@@ -74,7 +70,7 @@ getSunPos(const Direction2D position, const float timeOfYear2024)
udtSunCoordinates.x = udtSunCoordinates.x + two_pi;
}
// Parallax Correction
- const auto dParallax = (dEarthMeanRadius / dAstronomicalUnit) * sin(udtSunCoordinates.y);
+ const auto dParallax = (earthMeanRadius / astronomicalUnit) * sin(udtSunCoordinates.y);
udtSunCoordinates.y = half_pi - (udtSunCoordinates.y + dParallax);
return udtSunCoordinates;