cpp/motions/base.h
2024-11-10 15:52:54 +01:00

47 lines
1.3 KiB
C++

//
// Created by dominik on 8/12/24.
//
#ifndef RWSIM_MOTIONBASE_H
#define RWSIM_MOTIONBASE_H
#include "coordinates.h"
#include <random>
#include <unordered_map>
class Motion {
public:
virtual ~Motion() = default;
Motion(std::string, double, double, std::mt19937_64&);
explicit Motion(std::string, std::mt19937_64&);
SphericalPos draw_position();
[[nodiscard]] double omega_q(double, double) const;
[[nodiscard]] double omega_q(const SphericalPos&) const;
virtual void initialize() = 0;
virtual double jump() = 0;
virtual void setParameters(const std::unordered_map<std::string, double>&);
[[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);
protected:
std::string m_name{"Base motion"};
double m_delta{1.};
double m_eta{0.};
std::mt19937_64& m_rng;
std::uniform_real_distribution<> m_uni_dist;
};
std::ostream& operator<<(std::ostream& os, const Motion& m);
#endif //RWSIM_MOTIONBASE_H