-
Notifications
You must be signed in to change notification settings - Fork 0
/
planet.h
46 lines (37 loc) · 794 Bytes
/
planet.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
#pragma once
#include <armadillo>
//planet class for model of solar system
//class is so simple that it is defined
//here in its entirety
class planet
{
public:
planet(){}
arma::vec position;
arma::vec velocity;
double mass;
//3D:
planet(double m, double x, double y, double z, double vx, double vy, double vz)
{
mass = m;
position.set_size(3);
velocity.set_size(3);
position(0) = x;
position(1) = y;
position(2) = z;
velocity(0) = vx;
velocity(1) = vy;
velocity(2) = vz;
}
//2D:
planet(double m, double x, double y, double vx, double vy)
{
mass = m;
position.set_size(2);
velocity.set_size(2);
position(0) = x;
position(1) = y;
velocity(0) = vx;
velocity(1) = vy;
}
};