Example #1
0
        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);
                }
            }
        }
Example #2
0
 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);
     }
 }
Example #3
0
 public static double PingPong(double t, double length)
 {
     t = MathD.Repeat(t, length * 2d);
     return(length - MathD.Abs(t - length));
 }
Example #4
0
 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)), Epsilon));
 }