public static double Gamma(double value, double absmax, double gamma) { bool flag = false; if (value < 0.0) { flag = true; } double num1 = Mathd.Abs(value); if (num1 > absmax) { if (flag) { return(-num1); } else { return(num1); } } else { double num2 = Mathd.Pow(num1 / absmax, gamma) * absmax; if (flag) { return(-num2); } else { return(num2); } } }
public static double MoveTowards(double current, double target, double maxDelta) { if (Mathd.Abs(target - current) <= maxDelta) { return(target); } else { return(current + Mathd.Sign(target - current) * maxDelta); } }
public static double PingPong(double t, double length) { t = Mathd.Repeat(t, length * 2d); return(length - Mathd.Abs(t - length)); }
public static bool Approximately(double a, double b) { return(Mathd.Abs(b - a) < Mathd.Max(1E-06d * Mathd.Max(Mathd.Abs(a), Mathd.Abs(b)), 1.121039E-44d)); }