public static Quaternionf slerp(Quaternionf a, Quaternionf b, float percent) {
        final float inverted;
        float cosineTheta = a.dot(b);
        if (cosineTheta < 0) {
            cosineTheta = -cosineTheta;
            inverted = -1;
        } else {
            inverted = 1;
        }
        if (1 - cosineTheta < GenericMath.FLT_EPSILON) {
            return a.mul(1 - percent).add(b.mul(percent * inverted));
        }
        final float theta = (float) TrigMath.acos(cosineTheta);
        final float sineTheta = TrigMath.sin(theta);
        final float coefficient1 = TrigMath.sin((1 - percent) * theta) / sineTheta;
        final float coefficient2 = TrigMath.sin(percent * theta) / sineTheta * inverted;
        return a.mul(coefficient1).add(b.mul(coefficient2));
    }
public static Quaternionf slerp(Quaternionf a, Quaternionf b, float percent) {
        final float inverted;
        float cosineTheta = a.dot(b);
        if (cosineTheta < 0) {
            cosineTheta = -cosineTheta;
            inverted = -1;
        } else {
            inverted = 1;
        }
        if (1 - cosineTheta < GenericMath.FLT_EPSILON) {
            return a.mul(1 - percent).add(b.mul(percent * inverted));
        }
        final float theta = (float) TrigMath.acos(cosineTheta);
        final float sineTheta = TrigMath.sin(theta);
        final float coefficient1 = TrigMath.sin((1 - percent) * theta) / sineTheta;
        final float coefficient2 = TrigMath.sin(percent * theta) / sineTheta * inverted;
        return a.mul(coefficient1).add(b.mul(coefficient2));
    }
public static Quaternionf slerp ( Quaternionf a , Quaternionf b , float percent ) { final float inverted ; float cosineTheta = a . dot ( b ) ; if ( cosineTheta < 0 ) { cosineTheta = - cosineTheta ; inverted = - 1 ; } else { inverted = 1 ; } if ( 1 - cosineTheta < GenericMath . FLT_EPSILON ) { return a . mul ( 1 - percent ) . add ( b . mul ( percent * inverted ) ) ; } final float theta = ( float ) TrigMath . acos ( cosineTheta ) ; final float sineTheta = TrigMath . sin ( theta ) ; final float coefficient1 = TrigMath . sin ( ( 1 - percent ) * theta ) / sineTheta ; final float coefficient2 = TrigMath . sin ( percent * theta ) / sineTheta * inverted ; return a . mul ( coefficient1 ) . add ( b . mul ( coefficient2 ) ) ; }
Interpolates a quaternion between two others using spherical linear interpolation.

@param a The first quaternion
@param b The second quaternion
@param percent The percent for the interpolation, between 0 and 1 inclusively
@return The interpolated quaternion
Interpolates a quaternion between two others using spherical linear interpolation .