-
Notifications
You must be signed in to change notification settings - Fork 0
/
Star.h
85 lines (60 loc) · 2.18 KB
/
Star.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
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
// Copyright (c) Conni Bilham & Lucy Coward 2022, All Rights Reserved.
#ifndef C_VERSION_STAR_H
#define C_VERSION_STAR_H
#include "includes.h"
//#include "includes/Region.h"
#include "includes/RegionMatrix.h"
#include "includes/logging.h"
#include "includes/Vector3.h"
class Region;
enum class STAR_FLAGS
{
STATIC = 1 << 0, // 1
Flag2 = 1 << 1, // 2
Flag3 = 1 << 2, // 4
Flag4 = 1 << 3, // 8
Flag5 = 1 << 4, // 16
Flag6 = 1 << 5, // 32
Flag7 = 1 << 6, // 64
Flag8 = 1 << 7 //128
};
class history_record_t {
public:
Vectorr position, velocity, acceleration = {};
history_record_t() = default;
history_record_t(Vectorr position, Vectorr velocity, Vectorr acceleration) :
position(position), velocity(velocity), acceleration(acceleration) {}
};
class Star {
private:
unsigned char flags = 0;
public:
int first, second = -1;
// position uses parsecs and velocity uses pc/year
Star(int id, Vectorr position, Vectorr velocity, Vectorr acceleration, float mass, RegionMatrix* parent_region_matrix, int flags = 0) :
id(id), position(position), velocity(velocity), acceleration(acceleration), mass(mass), parent(parent_region_matrix) {
this->history.emplace_back(
history_record_t(this->position, this->velocity, this->acceleration)
);
// Push final history record
this->flags |= flags;
}
int id;
float mass;
Vectorr position, velocity, acceleration;