-
Notifications
You must be signed in to change notification settings - Fork 0
/
GravSim.h
58 lines (32 loc) · 1003 Bytes
/
GravSim.h
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
#ifndef GRAVSIM_H
#define GRAVSIM_H
#include <vector>
#include <cmath>
#include <cstdlib>
#include <iostream>
const double gravity_constant = 6.6743e-11;
class SpaceObject{
public:
double get_x();
double get_y();
double get_acceleration_x();
double get_acceleration_y();
double get_velocity_x();
double get_velocity_y();
void update_position(double& time);
void update_velocity(double& time);
void update_acceleration(SpaceObject& obj, double& directional_angle, double& distance);
void reset_acceleration();
SpaceObject(double x_pos, double y_pos, double my_mass);
private:
double mass;
double x;
double y;
double vx;
double vy;
double acceleration_x;
double acceleration_y;
};
double calculateAngle(SpaceObject& obj1, SpaceObject& obj2);
void calculateAcceleration(std::vector<SpaceObject*>& obj_vector, double& dt);
#endif