pub fn quat_slerp(t: Float, q1: &Quaternion, q2: &Quaternion) -> Quaternion {
    let cos_theta: Float = quat_dot_quat(q1, q2);
    if cos_theta > 0.9995 as Float {
        quat_normalize(&(*q1 * (1.0 as Float - t) + *q2 * t))
    } else {
        let theta: Float = clamp_t(cos_theta, -1.0 as Float, 1.0 as Float).acos();
        let thetap: Float = theta * t;
        let qperp: Quaternion = quat_normalize(&(*q2 - *q1 * cos_theta));
        *q1 * thetap.cos() + qperp * thetap.sin()
    }
}
/// Spherical linear interpolation gives constant speed motion along
/// great circle arcs on the surface of a sphere and consequently has
/// two desirable properties for interpolating rotations:
///
/// 1. The path to get between two rotations is the shortest possible
/// path in rotation space.
///
/// 2. The speed of interpolation is constant across the interpolation range
Spherical linear interpolation gives constant speed motion along
great circle arcs on the surface of a sphere and consequently has
two desirable properties for interpolating rotations.

1. The path to get between two rotations is the shortest possible
path in rotation space.

2. The speed of interpolation is constant across the interpolation range
Spherical linear interpolation gives constant speed motion along great circle arcs on the surface of a sphere and consequently has two desirable properties for interpolating rotations . 1 . The path to get between two rotations is the shortest possible path in rotation space . 2 . The speed of interpolation is constant across the interpolation range
pub fn quat_slerp(t: Float, q1: &Quaternion, q2: &Quaternion) -> Quaternion {
    let cos_theta: Float = quat_dot_quat(q1, q2);
    if cos_theta > 0.9995 as Float {
        quat_normalize(&(*q1 * (1.0 as Float - t) + *q2 * t))
    } else {
        let theta: Float = clamp_t(cos_theta, -1.0 as Float, 1.0 as Float).acos();
        let thetap: Float = theta * t;
        let qperp: Quaternion = quat_normalize(&(*q2 - *q1 * cos_theta));
        *q1 * thetap.cos() + qperp * thetap.sin()
    }
}
pub fn quat_slerp ( t : Float , q1 : & Quaternion , q2 : & Quaternion ) -> Quaternion { let cos_theta : Float = quat_dot_quat ( q1 , q2 ) ; if cos_theta > 0.9995 as Float { quat_normalize ( & ( * q1 * ( 1.0 as Float - t ) + * q2 * t ) ) } else { let theta : Float = clamp_t ( cos_theta , - 1.0 as Float , 1.0 as Float ) . acos ( ) ; let thetap : Float = theta * t ; let qperp : Quaternion = quat_normalize ( & ( * q2 - * q1 * cos_theta ) ) ; * q1 * thetap . cos ( ) + qperp * thetap . sin ( ) } }
Spherical linear interpolation gives constant speed motion along
great circle arcs on the surface of a sphere and consequently has
two desirable properties for interpolating rotations:
Spherical linear interpolation gives constant speed motion along great circle arcs on the surface of a sphere and consequently has two desirable properties for interpolating rotations :
t
Float
q1
&Quaternion
q2
&Quaternion