Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
randomorbit.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2025 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <random>
20
22
23namespace cqsp::common::util {
25 public:
26 OrbitGenerator(double position, double velocity) : OrbitGenerator(glm::dvec3(position), glm::dvec3(velocity)) {}
27 OrbitGenerator(glm::dvec3 position, glm::dvec3 velocity)
29 OrbitGenerator(double distribution) : OrbitGenerator(distribution, distribution) {}
30
31 common::components::types::Orbit GenerateOrbit(double GM, double time);
32 std::pair<glm::dvec3, glm::dvec3> GenerateVectors();
33
34 private:
35 double RandomValue(double range);
36 glm::dvec3 RandomVector(const glm::dvec3 &range);
37
40
41 std::random_device random_device;
42 std::mt19937 gen;
43};
44} // namespace cqsp::common::util
Definition: randomorbit.h:24
OrbitGenerator(double position, double velocity)
Definition: randomorbit.h:26
glm::dvec3 position_distribution
Definition: randomorbit.h:38
std::mt19937 gen
Definition: randomorbit.h:42
glm::dvec3 velocity_distribution
Definition: randomorbit.h:39
glm::dvec3 RandomVector(const glm::dvec3 &range)
Definition: randomorbit.cpp:37
std::pair< glm::dvec3, glm::dvec3 > GenerateVectors()
Definition: randomorbit.cpp:28
std::random_device random_device
Definition: randomorbit.h:41
double RandomValue(double range)
Definition: randomorbit.cpp:32
OrbitGenerator(double distribution)
Definition: randomorbit.h:29
OrbitGenerator(glm::dvec3 position, glm::dvec3 velocity)
Definition: randomorbit.h:27
common::components::types::Orbit GenerateOrbit(double GM, double time)
Definition: randomorbit.cpp:20
Definition: logging.cpp:55