public static FPQuaternion Slerp(FPQuaternion quaternion1, FPQuaternion quaternion2, pfloat amount) { pfloat num2; pfloat num3; FPQuaternion quaternion; pfloat num = amount; pfloat num4 = (((quaternion1.x * quaternion2.x) + (quaternion1.y * quaternion2.y)) + (quaternion1.z * quaternion2.z)) + (quaternion1.w * quaternion2.w); bool flag = false; if (num4 < 0f) { flag = true; num4 = -num4; } if (num4 > 0.999999f) { num3 = 1f - num; num2 = flag ? -num : num; } else { pfloat num5 = FPMath.ACos(num4); pfloat num6 = (1.0f / FPMath.Sin(num5)); num3 = (FPMath.Sin(((1f - num) * num5))) * num6; num2 = flag ? ((-FPMath.Sin((num * num5))) * num6) : ((FPMath.Sin((num * num5))) * num6); } quaternion.x = (num3 * quaternion1.x) + (num2 * quaternion2.x); quaternion.y = (num3 * quaternion1.y) + (num2 * quaternion2.y); quaternion.z = (num3 * quaternion1.z) + (num2 * quaternion2.z); quaternion.w = (num3 * quaternion1.w) + (num2 * quaternion2.w); return(quaternion); }
public static pfloat Angle(FPVector2 from, FPVector2 to) { var num = FPMath.Sqrt(from.sqrMagnitude * to.sqrMagnitude); return((float)num < 1.0000000036274937E-15 ? pfloat.Zero : FPMath.ACos(FPMath.Clamp(FPVector2.Dot(from, to) / num, -pfloat.One, pfloat.One)) * (pfloat)57.29578f); }