protected override void OnTimer(FPLibrary.Fix64 time) { base.OnTimer(time); if (this.timer != null) { this.timer.text = Mathf.Round((float)time).ToString().Replace("Infinity", "∞"); } }
/** * @brief Rotates a {@link FPVector} by the {@link FPQuanternion}. **/ public static FPVector operator *(FPQuaternion quat, FPVector vec) { Fix64 num = quat.x * 2f; Fix64 num2 = quat.y * 2f; Fix64 num3 = quat.z * 2f; Fix64 num4 = quat.x * num; Fix64 num5 = quat.y * num2; Fix64 num6 = quat.z * num3; Fix64 num7 = quat.x * num2; Fix64 num8 = quat.x * num3; Fix64 num9 = quat.y * num3; Fix64 num10 = quat.w * num; Fix64 num11 = quat.w * num2; Fix64 num12 = quat.w * num3; FPVector result; result.x = (1f - (num5 + num6)) * vec.x + (num7 - num12) * vec.y + (num8 + num11) * vec.z; result.y = (num7 + num12) * vec.x + (1f - (num4 + num6)) * vec.y + (num9 - num10) * vec.z; result.z = (num8 - num11) * vec.x + (num9 + num10) * vec.y + (1f - (num4 + num5)) * vec.z; return(result); }
public static FPQuaternion RotateTowards(FPQuaternion from, FPQuaternion to, Fix64 maxDegreesDelta) { Fix64 dot = Dot(from, to); if (dot < 0.0f) { to = Multiply(to, -1); dot = -dot; } Fix64 halfTheta = Fix64.Acos(dot); Fix64 theta = halfTheta * 2; maxDegreesDelta *= Fix64.Deg2Rad; if (maxDegreesDelta >= theta) { return(to); } maxDegreesDelta /= theta; return(Multiply(Multiply(from, Fix64.Sin((1 - maxDegreesDelta) * halfTheta)) + Multiply(to, Fix64.Sin(maxDegreesDelta * halfTheta)), 1 / Fix64.Sin(halfTheta))); }
public void Translate(Fix64 x, Fix64 y, Fix64 z, Space relativeTo) { Translate(new FPVector(x, y, z), relativeTo); }
public static FPQuaternion Lerp(FPQuaternion a, FPQuaternion b, Fix64 t) { t = FPMath.Clamp(t, Fix64.Zero, Fix64.One); return(LerpUnclamped(a, b, t)); }
public static void SmoothStep(ref FPVector2 value1, ref FPVector2 value2, Fix64 amount, out FPVector2 result) { result = new FPVector2( FPMath.SmoothStep(value1.x, value2.x, amount), FPMath.SmoothStep(value1.y, value2.y, amount)); }
public static void Multiply(ref FPVector2 value1, Fix64 scaleFactor, out FPVector2 result) { result.x = value1.x * scaleFactor; result.y = value1.y * scaleFactor; }
public void Scale(FPVector2 other) { this.x = x * other.x; this.y = y * other.y; }
public static void Barycentric(ref FPVector2 value1, ref FPVector2 value2, ref FPVector2 value3, Fix64 amount1, Fix64 amount2, out FPVector2 result) { result = new FPVector2( FPMath.Barycentric(value1.x, value2.x, value3.x, amount1, amount2), FPMath.Barycentric(value1.y, value2.y, value3.y, amount1, amount2)); }
public static FPVector2 Barycentric(FPVector2 value1, FPVector2 value2, FPVector2 value3, Fix64 amount1, Fix64 amount2) { return(new FPVector2( FPMath.Barycentric(value1.x, value2.x, value3.x, amount1, amount2), FPMath.Barycentric(value1.y, value2.y, value3.y, amount1, amount2))); }
public void Set(Fix64 x, Fix64 y) { this.x = x; this.y = y; }
/// <summary> /// Constructor for "square" vector. /// </summary> /// <param name="value"> /// A <see cref="System.Single"/> /// </param> public FPVector2(Fix64 value) { x = value; y = value; }
/// <summary> /// Constructor foe standard 2D vector. /// </summary> /// <param name="x"> /// A <see cref="System.Single"/> /// </param> /// <param name="y"> /// A <see cref="System.Single"/> /// </param> public FPVector2(Fix64 x, Fix64 y) { this.x = x; this.y = y; }
public void RotateAround(FPVector axis, Fix64 angle) { Rotate(axis, angle); }
public void Translate(Fix64 x, Fix64 y, Fix64 z, FPTransform relativeTo) { Translate(new FPVector(x, y, z), relativeTo); }
public static FPVector2 LerpUnclamped(FPVector2 value1, FPVector2 value2, Fix64 amount) { return(new FPVector2( FPMath.Lerp(value1.x, value2.x, amount), FPMath.Lerp(value1.y, value2.y, amount))); }
public static void LerpUnclamped(ref FPVector2 value1, ref FPVector2 value2, Fix64 amount, out FPVector2 result) { result = new FPVector2( FPMath.Lerp(value1.x, value2.x, amount), FPMath.Lerp(value1.y, value2.y, amount)); }
public static FPVector2 CatmullRom(FPVector2 value1, FPVector2 value2, FPVector2 value3, FPVector2 value4, Fix64 amount) { return(new FPVector2( FPMath.CatmullRom(value1.x, value2.x, value3.x, value4.x, amount), FPMath.CatmullRom(value1.y, value2.y, value3.y, value4.y, amount))); }
public static FPVector2 Multiply(FPVector2 value1, Fix64 scaleFactor) { value1.x *= scaleFactor; value1.y *= scaleFactor; return(value1); }
public static void Distance(ref FPVector2 value1, ref FPVector2 value2, out Fix64 result) { DistanceSquared(ref value1, ref value2, out result); result = (Fix64)Fix64.Sqrt(result); }
public static FPVector2 SmoothStep(FPVector2 value1, FPVector2 value2, Fix64 amount) { return(new FPVector2( FPMath.SmoothStep(value1.x, value2.x, amount), FPMath.SmoothStep(value1.y, value2.y, amount))); }
public static void DistanceSquared(ref FPVector2 value1, ref FPVector2 value2, out Fix64 result) { result = (value1.x - value2.x) * (value1.x - value2.x) + (value1.y - value2.y) * (value1.y - value2.y); }
public static Fix64 Angle(FPVector2 a, FPVector2 b) { return(Fix64.Acos(a.normalized * b.normalized) * Fix64.Rad2Deg); }
public static void Dot(ref FPVector2 value1, ref FPVector2 value2, out Fix64 result) { result = value1.x * value2.x + value1.y * value2.y; }
public static FPQuaternion Slerp(FPQuaternion from, FPQuaternion to, Fix64 t) { t = FPMath.Clamp(t, 0, 1); Fix64 dot = Dot(from, to); if (dot < 0.0f) { to = Multiply(to, -1); dot = -dot; } Fix64 halfTheta = Fix64.Acos(dot); return(Multiply(Multiply(from, Fix64.Sin((1 - t) * halfTheta)) + Multiply(to, Fix64.Sin(t * halfTheta)), 1 / Fix64.Sin(halfTheta))); }
public static FPVector2 Hermite(FPVector2 value1, FPVector2 tangent1, FPVector2 value2, FPVector2 tangent2, Fix64 amount) { FPVector2 result = new FPVector2(); Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); return(result); }
public static FPQuaternion Inverse(FPQuaternion rotation) { Fix64 invNorm = Fix64.One / ((rotation.x * rotation.x) + (rotation.y * rotation.y) + (rotation.z * rotation.z) + (rotation.w * rotation.w)); return(FPQuaternion.Multiply(FPQuaternion.Conjugate(rotation), invNorm)); }
public static void Hermite(ref FPVector2 value1, ref FPVector2 tangent1, ref FPVector2 value2, ref FPVector2 tangent2, Fix64 amount, out FPVector2 result) { result.x = FPMath.Hermite(value1.x, tangent1.x, value2.x, tangent2.x, amount); result.y = FPMath.Hermite(value1.y, tangent1.y, value2.y, tangent2.y, amount); }
public static FPVector2 ClampMagnitude(FPVector2 vector, Fix64 maxLength) { return(Normalize(vector) * maxLength); }
public void Translate(Fix64 x, Fix64 y, Fix64 z) { Translate(x, y, z, Space.Self); }