Quaternion.h
Quaternion static Nlerp(Quaternion a, Quaternion b, float alpha)
	{
		Quaternion result = Quaternion();

		float dot = Dot(a, b);

		float oneMinusAlpha = 1.0f - alpha;

		if (dot < 0) {
			result.r = oneMinusAlpha * a.r + alpha * -b.r;
			result.i = oneMinusAlpha * a.i + alpha * -b.i;
			result.j = oneMinusAlpha * a.j + alpha * -b.j;
			result.k = oneMinusAlpha * a.k + alpha * -b.k;
		}
		else {
			result.r = oneMinusAlpha * a.r + alpha * b.r;
			result.i = oneMinusAlpha * a.i + alpha * b.i;
			result.j = oneMinusAlpha * a.j + alpha * b.j;
			result.k = oneMinusAlpha * a.k + alpha * b.k;
		}
		result.Normalize();
		return result;
	}
//Normally interpolates between a and b
Normally interpolates between a and b
Normally interpolates between a and b
Quaternion static Nlerp(Quaternion a, Quaternion b, float alpha)
	{
		Quaternion result = Quaternion();
		float dot = Dot(a, b);
		float oneMinusAlpha = 1.0f - alpha;
		if (dot < 0) {
			result.r = oneMinusAlpha * a.r + alpha * -b.r;
			result.i = oneMinusAlpha * a.i + alpha * -b.i;
			result.j = oneMinusAlpha * a.j + alpha * -b.j;
			result.k = oneMinusAlpha * a.k + alpha * -b.k;
		}
		else {
			result.r = oneMinusAlpha * a.r + alpha * b.r;
			result.i = oneMinusAlpha * a.i + alpha * b.i;
			result.j = oneMinusAlpha * a.j + alpha * b.j;
			result.k = oneMinusAlpha * a.k + alpha * b.k;
		}
		result.Normalize();
		return result;
	}
Quaternion static Nlerp ( Quaternion a , Quaternion b , float alpha ) { Quaternion result = Quaternion ( ) ; float dot = Dot ( a , b ) ; float oneMinusAlpha = 1.0f - alpha ; if ( dot < 0 ) { result . r = oneMinusAlpha * a . r + alpha * - b . r ; result . i = oneMinusAlpha * a . i + alpha * - b . i ; result . j = oneMinusAlpha * a . j + alpha * - b . j ; result . k = oneMinusAlpha * a . k + alpha * - b . k ; } else { result . r = oneMinusAlpha * a . r + alpha * b . r ; result . i = oneMinusAlpha * a . i + alpha * b . i ; result . j = oneMinusAlpha * a . j + alpha * b . j ; result . k = oneMinusAlpha * a . k + alpha * b . k ; } result . Normalize ( ) ; return result ; }
Normally interpolates between a and b
Normally interpolates between a and b