88 auto const S1 = Qd.
norm2();
93 0.5 * (-p.
quat()[1] * Wd[0] - p.
quat()[2] * Wd[1] - p.
quat()[3] * Wd[2]) -
97 0.5 * (p.
quat()[0] * Wd[0] - p.
quat()[3] * Wd[1] + p.
quat()[2] * Wd[2]) -
101 0.5 * (p.
quat()[3] * Wd[0] + p.
quat()[0] * Wd[1] - p.
quat()[1] * Wd[2]) -
105 0.5 * (-p.
quat()[2] * Wd[0] + p.
quat()[1] * Wd[1] + p.
quat()[0] * Wd[2]) -
109 S[1] = Utils::dot(Qd, Qdd);
136 auto const time_step_squared = time_step * time_step;
137 auto const time_step_half = 0.5 * time_step;
141 1 - time_step_squared *
143 time_step * (S[1] + time_step_half / 2. * (S[2] - S[0] * S[0])));
144 assert(square >= 0.);
145 auto const lambda = 1 - S[0] * 0.5 * time_step_squared - sqrt(square);
147 p.
omega() += time_step_half * Wd;
148 p.
quat() += time_step * (Qd + time_step_half * Qdd) - lambda * p.
quat();
151 auto const scale = p.
quat().norm();
177 for (
int times = 0; times <= 5; times++) {
184 p.
omega() = omega_0 + (0.5 * time_step) * Wd;
189 for (
auto &p : particles) {
Vector implementation and trait types for boost qvm interoperability.
auto mask(Integral mask, T t) -> std::enable_if_t< std::is_unsigned_v< Integral > &&(size_in_bits< Integral >::value >=tuple_size< T >::value), T >
Pick elements of a tuple-like by a bit mask.
void convert_initial_torques(const ParticleRange &particles)
Convert torques to the body-fixed frame before the integration loop.
void propagate_omega_quat_particle(Particle &p, double time_step)
See .
void convert_torque_propagate_omega(Particle &p, double time_step)
static void define_Qdd(Particle const &p, Utils::Quaternion< double > &Qd, Utils::Quaternion< double > &Qdd, Utils::Vector3d &S, Utils::Vector3d &Wd)
Calculate the derivatives of the quaternion and angular acceleration for a given particle.
This file contains all subroutines required to process rotational motion.
void convert_torque_to_body_frame_apply_fix(Particle &p)
Struct holding all information for one particle.
auto const & rinertia() const
auto const & quat() const
auto const & rotation() const
bool can_rotate_around(unsigned int const axis) const
auto const & torque() const
auto const & omega() const
Quaternion representation.
static Quaternion< T > identity()
Construct an identity quaternion.
value_type norm2() const
Retrieve the square of the norm of the quaternion.