25 m_cos_half_twist_min = std::cos(min_angle * 0.5f);
26 m_sin_half_twist_min = std::sin(min_angle * 0.5f);
27 m_cos_half_twist_max = std::cos(max_angle * 0.5f);
28 m_sin_half_twist_max = std::sin(max_angle * 0.5f);
42 if (twist.w() < m_cos_half_twist_min)
44 twist.w() = m_cos_half_twist_min;
45 twist.z() = m_sin_half_twist_min;
47 else if (twist.w() > m_cos_half_twist_max)
49 twist.w() = m_cos_half_twist_max;
50 twist.z() = m_sin_half_twist_max;
void solve(math::fquat &q) override
Solves the constraint.
void set_twist_limit(float min_angle, float max_angle)
Sets the twist rotation limit.
quaternion< T > normalize(const quaternion< T > &q)
Normalizes a quaternion.
std::array< quaternion< T >, 2 > swing_twist(const quaternion< T > &q, const vec3< T > &twist_axis, T tolerance=T{1e-6})
Decomposes a quaternion into swing and twist rotation components.
Quaternion composed of a real scalar part and imaginary vector part.