public GodotQuat Slerpni(GodotQuat b, float t) { float s1 = Dot(b); if (GodotMathf.Abs(s1) > 0.999899983406067) { return(this); } float s2 = GodotMathf.Acos(s1); float num1 = 1f / GodotMathf.Sin(s2); float num2 = GodotMathf.Sin(t * s2) * num1; float num3 = GodotMathf.Sin((1f - t) * s2) * num1; return(new GodotQuat((num3 * x) + (num2 * b.x), (num3 * y) + (num2 * b.y), (num3 * z) + (num2 * b.z), (num3 * w) + (num2 * b.w))); }
public GodotQuat Slerp(GodotQuat b, float t) { float s1 = ((x * b.x) + (y * b.y) + (z * b.z) + (w * b.w)); float[] numArray = new float[4]; if (s1 < 0.0) { s1 = -s1; numArray[0] = -b.x; numArray[1] = -b.y; numArray[2] = -b.z; numArray[3] = -b.w; } else { numArray[0] = b.x; numArray[1] = b.y; numArray[2] = b.z; numArray[3] = b.w; } float num1; float num2; if (1.0 - s1 > 9.99999997475243E-07) { float s2 = GodotMathf.Acos(s1); float num3 = GodotMathf.Sin(s2); num1 = GodotMathf.Sin((1f - t) * s2) / num3; num2 = GodotMathf.Sin(t * s2) / num3; } else { num1 = 1f - t; num2 = t; } return(new GodotQuat((num1 * x) + (num2 * numArray[0]), (num1 * y) + (num2 * numArray[1]), (num1 * z) + (num2 * numArray[2]), (num1 * w) + (num2 * numArray[3]))); }