GlmSharp/GlmSharp5/Quat/quat.cs
/// <summary>
/// Calculates a proper spherical interpolation between two quaternions (only works for normalized quaternions).
/// </summary>
Calculates a proper spherical interpolation between two quaternions (only works for normalized quaternions).
Calculates a proper spherical interpolation between two quaternions ( only works for normalized quaternions ) .
public static quat Mix(quat x, quat y, float a)
        {
            var cosTheta = (double)Dot(x, y);
            if (cosTheta > 1 - float.Epsilon)
                return Lerp(x, y, a);
            else
            {
                var angle = Math.Acos((double)cosTheta);
                return (quat)( (Math.Sin((1 - (double)a) * angle) * (dquat)x + Math.Sin((double)a * angle) * (dquat)y) / Math.Sin(angle) );
            }
        }
public static quat Mix ( quat x , quat y , float a ) { var cosTheta = ( double ) Dot ( x , y ) ; if ( cosTheta > 1 - float . Epsilon ) return Lerp ( x , y , a ) ; else { var angle = Math . Acos ( ( double ) cosTheta ) ; return ( quat ) ( ( Math . Sin ( ( 1 - ( double ) a ) * angle ) * ( dquat ) x + Math . Sin ( ( double ) a * angle ) * ( dquat ) y ) / Math . Sin ( angle ) ) ; } }
Calculates a proper spherical interpolation between two quaternions (only works for normalized quaternions).
Calculates a proper spherical interpolation between two quaternions ( only works for normalized quaternions ) .
x
quat
y
quat
a
float