-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (33 loc) · 1002 Bytes
/
main.cpp
File metadata and controls
42 lines (33 loc) · 1002 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
37
38
39
40
41
42
#include "physics/orbit.hpp"
#include "physics/rotation.hpp"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <vector>
int main()
{
srand(time(0));
constexpr double TIME_STEP_SEC = 0.1;
constexpr int SIMULATION_LENGTH_SEC = 100000;
Orbit ord = Orbit();
Rotation r = Rotation();
std::vector<std::ofstream> outputs = std::vector<std::ofstream>();
std::ofstream positionOut("positions.csv");
std::ofstream rotationOut("rotations.csv");
if (!positionOut.is_open() || !rotationOut.is_open())
{
std::cerr << "Error: Could not open the file." << std::endl;
return 1;
}
for (int i = 0; i < SIMULATION_LENGTH_SEC; i++)
{
ord.update(TIME_STEP_SEC);
r.update(TIME_STEP_SEC);
positionOut << ord.position << ",\n";
// rotationOut << Vector3::magnitude(r.rotation) << "\n";
rotationOut << r.rotation << ",\n";
}
positionOut.close();
rotationOut.close();
return 0;
}