cpp/motions/base.h

47 lines
1.3 KiB
C
Raw Permalink Normal View History

2024-08-16 17:55:27 +00:00
//
// Created by dominik on 8/12/24.
//
#ifndef RWSIM_MOTIONBASE_H
#define RWSIM_MOTIONBASE_H
2024-08-23 16:33:38 +00:00
#include "coordinates.h"
2024-08-16 17:55:27 +00:00
#include <random>
2024-11-10 14:52:54 +00:00
#include <unordered_map>
2024-08-16 17:55:27 +00:00
class Motion {
public:
virtual ~Motion() = default;
Motion(std::string, double, double, std::mt19937_64&);
explicit Motion(std::string, std::mt19937_64&);
2024-08-16 17:55:27 +00:00
2024-08-23 16:33:38 +00:00
SphericalPos draw_position();
2024-08-16 17:55:27 +00:00
[[nodiscard]] double omega_q(double, double) const;
2024-08-23 16:33:38 +00:00
[[nodiscard]] double omega_q(const SphericalPos&) const;
2024-08-16 17:55:27 +00:00
2024-08-18 11:21:27 +00:00
virtual void initialize() = 0;
2024-08-16 17:55:27 +00:00
virtual double jump() = 0;
2024-11-10 14:52:54 +00:00
virtual void setParameters(const std::unordered_map<std::string, double>&);
2024-08-16 17:55:27 +00:00
[[nodiscard]] double getDelta() const { return m_delta; }
void setDelta(const double delta) { m_delta = delta; }
[[nodiscard]] double getEta() const { return m_eta; }
void setEta(const double eta) { m_eta = eta; }
[[nodiscard]] std::string getName() const { return m_name; }
static Motion* createFromInput(const std::string& input, std::mt19937_64& rng);
2024-08-16 17:55:27 +00:00
2024-08-18 11:21:27 +00:00
protected:
std::string m_name{"Base motion"};
2024-08-16 17:55:27 +00:00
double m_delta{1.};
double m_eta{0.};
std::mt19937_64& m_rng;
2024-08-18 11:21:27 +00:00
std::uniform_real_distribution<> m_uni_dist;
2024-08-16 17:55:27 +00:00
};
std::ostream& operator<<(std::ostream& os, const Motion& m);
2024-09-16 17:52:51 +00:00
2024-08-16 17:55:27 +00:00
#endif //RWSIM_MOTIONBASE_H