Exemple #1
0
 static public float GetMultiplierFillByMultiplier(this float item, float target, float multiplier)
 {
     return(Mathq.Pow(
                multiplier,
                item.GetPowerFillByMultiplier(target, multiplier)
                ));
 }
Exemple #2
0
        static public IGrid <T> SoftCircle <T>(int radius, float hardness, float power, Operation <T, float> operation)
        {
            float transition_interval = 1.0f - hardness;

            return(Circle <T>(radius, delegate(float distance) {
                float weight = 0.0f;

                if (distance <= 1.0f)
                {
                    weight = 1.0f;

                    if (distance > hardness)
                    {
                        float transition_distance = distance - hardness;
                        float transition_percent = transition_distance / transition_interval;

                        weight = Mathq.Pow(transition_percent, power).InterpolateWith(1.0f, 0.0f);
                    }
                }

                return operation(weight);
            }));
        }
Exemple #3
0
 static public float GetAtPrecision(this float item, int exponent)
 {
     return(item.GetQuantizedMin((float)Mathq.Pow(10, exponent)));
 }
Exemple #4
0
 static public decimal GetAtPrecision(this decimal item, int exponent)
 {
     return(item.GetQuantizedMin((decimal)Mathq.Pow(10, exponent)));
 }
Exemple #5
0
 static public double GetAtPrecision(this double item, int exponent)
 {
     return(item.GetQuantizedMin((double)Mathq.Pow(10, exponent)));
 }