cpp/motions/tetrahedral.cpp
2024-09-16 19:52:51 +02:00

29 lines
738 B
C++

//
// Created by dominik on 8/16/24.
//
#include <random>
#include "tetrahedral.h"
TetrahedralJump::TetrahedralJump(const double delta, const double eta, std::mt19937_64& rng) : Motion(delta, eta, rng) {}
TetrahedralJump::TetrahedralJump(std::mt19937_64& rng) : Motion(rng) {}
void TetrahedralJump::initialize() {
const auto pos = draw_position();
m_corners[0] = omega_q(pos);
const double alpha = 2. * M_PI * m_uni_dist(m_rng);
for (int i = 1; i<4; i++) {
auto corner_pos = rotate(pos, m_beta, alpha + (i-1) * 2*M_PI/3.);
m_corners[i] = omega_q(corner_pos);
}
}
double TetrahedralJump::jump() {
m_corner_idx += m_chooser(m_rng);
m_corner_idx %= 4;
return m_corners[m_corner_idx];
}