public FPQuaternion(pfloat x, pfloat y, pfloat z, pfloat w) { this.x = x; this.y = y; this.z = z; this.w = w; }
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 void Inverse() { var num2 = (((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)) + (this.w * this.w); var num = 1f / num2; this.x = -this.x * num; this.y = -this.y * num; this.z = -this.z * num; this.w = this.w * num; }
public static FPVector2 Rotate(FPVector2 v, pfloat degrees) { pfloat radians = degrees * FPMath.Deg2Rad; pfloat sin = FPMath.Sin(radians); pfloat cos = FPMath.Cos(radians); pfloat tx = v.x; pfloat ty = v.y; return(new FPVector2(cos * tx - sin * ty, sin * tx + cos * ty)); }
public static pfloat Clamp(pfloat value, pfloat min, pfloat max) { if (value < min) { value = min; } else if (value > max) { value = max; } return(value); }
public static FPVector2 MoveTowards( FPVector2 current, FPVector2 target, pfloat maxDistanceDelta) { pfloat num1 = target.x - current.x; pfloat num2 = target.y - current.y; pfloat num4 = (num1 * num1 + num2 * num2); if (num4 == 0f || maxDistanceDelta >= 0f && num4 <= maxDistanceDelta * maxDistanceDelta) { return(target); } var num5 = FPMath.Sqrt(num4); return(new FPVector2(current.x + num1 / num5 * maxDistanceDelta, current.y + num2 / num5 * maxDistanceDelta)); }
public static FPQuaternion Euler(pfloat roll, pfloat pitch, pfloat yaw) { FPQuaternion quaternion; var num9 = roll * 0.5f; var num6 = FPMath.Sin(num9); var num5 = FPMath.Cos(num9); var num8 = pitch * 0.5f; var num4 = FPMath.Sin(num8); var num3 = FPMath.Cos(num8); var num7 = yaw * 0.5f; var num2 = FPMath.Sin(num7); var num = FPMath.Cos(num7); quaternion.x = ((num * num4) * num5) + ((num2 * num3) * num6); quaternion.y = ((num2 * num3) * num5) - ((num * num4) * num6); quaternion.z = ((num * num3) * num6) - ((num2 * num4) * num5); quaternion.w = ((num * num3) * num5) + ((num2 * num4) * num6); return(quaternion); }
public static pfloat Sqrt(pfloat v) { return(pfloat.Sqrt(v)); }
public FPVector3(pfloat x, pfloat y, pfloat z) { this.x = x; this.y = y; this.z = z; }
public static pfloat Clamp01(pfloat value) { return(FPMath.Clamp(value, 0f, 1f)); }
public static FPVector3 Lerp(FPVector3 a, FPVector3 b, pfloat t) { t = FPMath.Clamp01(t); return(new FPVector3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t)); }
public static pfloat Floor(pfloat value) { return(pfloat.Floor(value)); }
public static pfloat Lerp(pfloat a, pfloat b, pfloat t) { return(a + (b - a) * FPMath.Clamp01(t)); }
public static pfloat Min(pfloat v1, pfloat v2) { return(v1 < v2 ? v1 : v2); }
public static pfloat Max(pfloat v1, pfloat v2) { return(v1 > v2 ? v1 : v2); }
public static pfloat ASin(pfloat value) { return(UnityEngine.Mathf.Asin(value)); }
public static FPVector2 Lerp(FPVector2 a, FPVector2 b, pfloat t) { t = FPMath.Clamp01(t); return(new FPVector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t)); }
public static pfloat Atan(pfloat z) { return(pfloat.Atan(z)); }
public static int Sign(pfloat value) { return(pfloat.Sign(value)); }
public static pfloat Round(pfloat value) { return(pfloat.Round(value)); }
public FPVector2(pfloat x, pfloat y) { this.x = x; this.y = y; }
public static pfloat Abs(pfloat value) { return(pfloat.Abs(value)); }
public static pfloat Pow(pfloat value, pfloat exp) { return(pfloat.Pow(value, exp)); }
public static pfloat Sin(pfloat value) { return(pfloat.Sin(value)); }
public static pfloat ACos(pfloat value) { return(pfloat.Acos(value)); }
public static pfloat Atan2(pfloat y, pfloat x) { return(pfloat.Atan2(y, x)); }
public static pfloat Cos(pfloat value) { return(pfloat.Cos(value)); }
public static pfloat Repeat(pfloat t, pfloat length) { return(FPMath.Clamp(t - FPMath.Floor(t / length) * length, pfloat.Zero, length)); }