-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathorbits.h
More file actions
36 lines (30 loc) · 737 Bytes
/
orbits.h
File metadata and controls
36 lines (30 loc) · 737 Bytes
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
#define ERR_INVALID_INPUT 1
#define ERR_MALLOC_FAIL 2
#define ERR_FILE_OPEN 3
#define ERR_PGPLOT 4
// newtypes
typedef struct {
float dt;
float t;
float G;
} environment;
typedef struct {
float x;
float y;
float z;
} vector;
typedef struct {
vector r;
vector rold;
vector v;
vector a;
float m;
} particle;
void orbitEulerStep(environment *env, particle *p1, particle *p2);
void orbitRKStep(environment *env, particle *p1, particle *p2);
void orbitLeapfrogStep(environment *env, particle *p1, particle *p2);
float dvxdtGrav(float t, float x, float y);
float dvydtGrav(float t, float x, float y);
void initParticleZeroes(particle *p);
// miscellaneous
void errorCase(const int errorCode);