summaryrefslogtreecommitdiffstats
path: root/src/ballistics.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ballistics.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ballistics.c b/src/ballistics.c
index 10d97da..418318a 100644
--- a/src/ballistics.c
+++ b/src/ballistics.c
@@ -4,6 +4,12 @@
#include "constants.h"
#include "context.h"
+static inline double speed_of_sound(double temperature);
+static inline double calculate_retard(DragModel drag_function,
+ double ballistic_coefficient,
+ double velocity,
+ double mach);
+
double atmospheric_correction(double ballistic_coefficient,
double temperature,
double pressure,
@@ -36,3 +42,28 @@ double calculate_air_density(double temperature,
else
return pressure / (SPECIFIC_GAST_CONSTANT_DRY_AIR * temperature);
}
+
+static inline double speed_of_sound(double temperature) {
+ return sqrt(331.3 * (1.0 + temperature - 273.15 / 273.15));
+}
+
+static inline double
+calculate_retard(DragModel ballistic_model,
+ double ballistic_coefficient,
+ double velocity,
+ double mach)
+{
+ double m = velocity / mach;
+for (int i = 0
+}
+
+double retard(DragModel ballistic_model,
+ double ballistic_coefficient,
+ double velocity,
+ double temperature)
+{
+ return calculate_retard(ballistic_model,
+ ballistic_coefficient,
+ velocity,
+ speed_of_sound(temperature));
+}