cpp/motions/bimodalangle.cpp

34 lines
1.1 KiB
C++
Raw Permalink Normal View History

2024-09-16 17:52:51 +00:00
//
// Created by dominik on 8/23/24.
//
#include "bimodalangle.h"
#include "base.h"
BimodalAngle::BimodalAngle(const double delta, const double eta, const double angle1, const double angle2, const double prob, std::mt19937_64 &rng) :
Motion(std::string("Bimodal Angle Jump"), delta, eta, rng),
2024-09-16 17:52:51 +00:00
m_angle1(angle1 * M_PI / 180.0),
m_angle2(angle2 * M_PI / 180.0),
m_prob(prob) {};
BimodalAngle::BimodalAngle(std::mt19937_64 &rng) : Motion(std::string("Bimodal Angle Jump"), rng) {}
2024-09-16 17:52:51 +00:00
void BimodalAngle::initialize() {
m_prev_pos = draw_position();
};
double BimodalAngle::jump() {
const double angle = m_uni_dist(m_rng) < m_prob ? m_angle1 : m_angle2;
const double gamma{2 * M_PI * m_uni_dist(m_rng)};
m_prev_pos = rotate(m_prev_pos, angle, gamma);
return omega_q(m_prev_pos);
}
2024-11-10 14:52:54 +00:00
void BimodalAngle::setParameters(const std::unordered_map<std::string, double> &parameter) {
Motion::setParameters(parameter);
m_angle1 = parameter.at("angle1") * M_PI / 180.;
m_angle2 = parameter.at("angle2") * M_PI / 180.;
m_prob = parameter.at("probability1");
}