diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-07-18 11:44:43 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-07-18 11:44:43 +0300 |
| commit | 17eaf66bb7713378b95cce0fccd2cf32bde213a6 (patch) | |
| tree | d5a0d7221c6976ab7dbdd6a53e04d47208ac83ac /include | |
| parent | 2cff971b86fdd0f53014d302d66c83cd5a6088c5 (diff) | |
| download | a3catragmx-17eaf66bb7713378b95cce0fccd2cf32bde213a6.tar.gz a3catragmx-17eaf66bb7713378b95cce0fccd2cf32bde213a6.tar.bz2 a3catragmx-17eaf66bb7713378b95cce0fccd2cf32bde213a6.zip | |
add: tmp
Diffstat (limited to 'include')
| -rw-r--r-- | include/ballistics.h | 3 | ||||
| -rw-r--r-- | include/constants.h | 1 | ||||
| -rw-r--r-- | include/context.h | 14 | ||||
| -rw-r--r-- | include/drag_model.h | 23 | ||||
| -rw-r--r-- | include/vector.h | 9 |
5 files changed, 37 insertions, 13 deletions
diff --git a/include/ballistics.h b/include/ballistics.h index 84a883d..ab68c3f 100644 --- a/include/ballistics.h +++ b/include/ballistics.h @@ -2,6 +2,7 @@ #define ACE_BALLISTICS_H #include "context.h" +#include "drag_model.h" double atmospheric_correction(double ballistic_coefficient, double temperature, @@ -13,7 +14,7 @@ double calculate_air_density(double temperature, double pressure, double relative_humidity); -double retard(DragModel ballistic_model, +double retard(DragFunction drag_function, double ballistic_coefficient, double velocity, double temperature); diff --git a/include/constants.h b/include/constants.h index cfc9c80..026ff7b 100644 --- a/include/constants.h +++ b/include/constants.h @@ -9,5 +9,6 @@ static const double UNIVERSAL_GAS_CONSTANT = 8.31432; static const double SPECIFIC_GAST_CONSTANT_DRY_AIR = 287.057036320950; static const double STD_AIR_DENSITY_ICAO = 1.22498; static const double STD_AIR_DENSITY_ASM = 1.20886; +static const double BC_CONVERSION_FACTOR = 0.00068418; #endif diff --git a/include/context.h b/include/context.h index 65b4585..5dfad31 100644 --- a/include/context.h +++ b/include/context.h @@ -6,17 +6,7 @@ #include <stdbool.h> #include "ace.h" - -typedef enum { - BC_UNKNOWN = 0, - BC_G1, - BC_G2, - BC_G3, - BC_G4, - BC_G5, - BC_G6, - BC_G7, -} DragModel; +#include "drag_model.h" typedef enum { ICAO, @@ -29,7 +19,7 @@ typedef struct { double bore_height; double muzzle_velocity; double ballistic_coef; - size_t drag_model; + DragFunction drag_model; double twist_dir; } GunConfig; diff --git a/include/drag_model.h b/include/drag_model.h index baf5f72..8c18bed 100644 --- a/include/drag_model.h +++ b/include/drag_model.h @@ -1,6 +1,29 @@ #ifndef DRAG_MODEL_H #define DRAG_MODEL_H +#include <stddef.h> +typedef enum { + DRAG_G1, + DRAG_G2, + DRAG_G5, + DRAG_G6, + DRAG_G7, + DRAG_G8, + DRAG_COUNT +} DragFunction; + +typedef struct { + size_t num_points; + const double *mach; + const double *cd; +} DragModel; + +extern const DragModel drag_models[DRAG_COUNT]; + +static inline const DragModel* get_drag_model(DragFunction func) { + if (func >= DRAG_COUNT) return NULL; + return &drag_models[func]; +} #endif diff --git a/include/vector.h b/include/vector.h new file mode 100644 index 0000000..5b0d2de --- /dev/null +++ b/include/vector.h @@ -0,0 +1,9 @@ +#pragma once +#include "vector.h" +#include <stdlib.h> + +typedef struct vector_t vector_t; + +vector_t* vector_new(void); +void vector_ctr(vector_t* obj); +void vector_dtr(vector_t* obj); |
