summaryrefslogtreecommitdiffstats
path: root/include/context.h
blob: ce5f91301d2ebf969f91179eaad272a6e19d9799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef CONTEXT_H
#define CONTEXT_H

#include <stddef.h>
#include <stdlib.h>
#include <stdbool.h>

#include "drag_model.h"

typedef enum {
	ICAO,
	ASM,
} AtmosphereModel;

typedef struct {
	double scope_angle;
	double bullet_mass;
	double bore_height;
	double muzzle_velocity;
	double ballistic_coef;
	DragFunction drag_model;
	double twist_dir;
	double air_friction;
} GunConfig;

typedef struct {
	double temperature;
	double barometric_pressure;
	double relative_humidity;
	double wind_speed[2];
	size_t wind_dir;
	AtmosphereModel atmosphere_model;
} AtmoContext;

typedef struct {
	double speed;
	double range;
	double inclination_angle;
	double latitude;
	size_t direction;
} TargetContext;

typedef struct {
	GunConfig gun;
	TargetContext target;
	AtmoContext atmosphere;
	size_t sim_steps;
	bool store_range_card;
	size_t stability_factor;
} ATragMXContext;

typedef struct {
	double w1;
	double w2;
} Windage;

typedef struct RangeCardRecord RangeCardRecord;
struct RangeCardRecord {
	size_t n;
	double range;
	double elevation;
	Windage windage;
	double lead;
	double time_of_flight;
	double bullet_speed;
	double kinetic_energy;
};

typedef struct RangeCard RangeCard;
struct RangeCard {
	RangeCardRecord *card;
	size_t records;
};

typedef struct {
	double elev;
	Windage windage;
	double lead;
	double time_of_flight;
	double remaining_velocity;
	double remaining_energy;
	double coriolis_vdrift;
	double coriolis_hdrift;
	double spin_drift;
	RangeCard *range_card;
} ATragMXSolution;

#endif