Exemple #1
0
        public override double Evaluate(double x)
        {
            double controlValue = Control.Evaluate(x);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Functions.SmoothStep(
                           Source0.Evaluate(x), Source1.Evaluate(x), alpha));
            }
            else if (controlValue < (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x));
            }
            else if (controlValue < (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Functions.SmoothStep(
                           Source1.Evaluate(x), Source0.Evaluate(x), alpha));
            }
            else
            {
                return(Source0.Evaluate(x));
            }
        }
Exemple #2
0
        public override double Evaluate(double x, double y)
        {
            double controlValue = Control.Evaluate(x, y);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x, y));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.Lerp(
                           Source0.Evaluate(x, y), Source1.Evaluate(x, y), alpha));
            }
            else if (controlValue <= (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x, y));
            }
            else if (controlValue <= (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.Lerp(
                           Source1.Evaluate(x, y), Source0.Evaluate(x, y), alpha));
            }
            else
            {
                return(Source0.Evaluate(x, y));
            }
        }
Exemple #3
0
        public override double Evaluate(double x, double y, double z, double w, double v, double u)
        {
            double controlValue = Control.Evaluate(x, y, z, w, v, u);

            if (controlValue < (LowerBound - EdgeFalloff))
            {
                return(Source0.Evaluate(x, y, z, w, v, u));
            }
            else if (controlValue < (LowerBound + EdgeFalloff))
            {
                double lowerCurve = LowerBound - EdgeFalloff;
                double upperCurve = LowerBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.SmoothStep(
                           Source0.Evaluate(x, y, z, w, v, u), Source1.Evaluate(x, y, z, w, v, u), alpha));
            }
            else if (controlValue < (UpperBound - EdgeFalloff))
            {
                return(Source1.Evaluate(x, y, z, w, v, u));
            }
            else if (controlValue < (UpperBound + EdgeFalloff))
            {
                double lowerCurve = UpperBound - EdgeFalloff;
                double upperCurve = UpperBound + EdgeFalloff;
                double alpha      = (controlValue - lowerCurve) / (upperCurve - lowerCurve);
                return(Numerics.Functions.SmoothStep(
                           Source1.Evaluate(x, y, z, w, v, u), Source0.Evaluate(x, y, z, w, v, u), alpha));
            }
            else
            {
                return(Source0.Evaluate(x, y, z, w, v, u));
            }
        }
    /// <summary>
    /// Retrieve noise value
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    /// <returns></returns>
    public override double GetValue(double x, double y, double z)
    {
        double val = Source0.GetValue(x, y, z);

        val *= val > Center ? AboveCenterScale : BelowCenterScale;
        return(val + Bias);
    }
Exemple #5
0
 /// <summary>
 /// Retrieve noise value
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 /// <returns></returns>
 public override double GetValue(double x, double y, double z)
 {
     x = Left ? (int)Math.Floor(x) << Amount : (int)Math.Floor(x) >> Amount;
     y = Left ? (int)Math.Floor(y) << Amount : (int)Math.Floor(y) >> Amount;
     z = Left ? (int)Math.Floor(z) << Amount : (int)Math.Floor(z) >> Amount;
     return(Source0.GetValue(x, y, z));
 }
Exemple #6
0
    /// <summary>
    /// Perform blur.
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    /// <returns></returns>
    public override double GetValue(double x, double y, double z)
    {
        var    self     = Source0.GetValue(x, y, z);
        double distance = Distance;

        return((
                   self +
                   Source0.GetValue(x, y, z + distance) +
                   Source0.GetValue(x, y, z - distance) +
                   Source0.GetValue(x + distance, y, z) +
                   Source0.GetValue(x - distance, y, z)
                   ) / 5d);
    }
Exemple #7
0
    /// <summary>
    /// Detect transitions in source map.
    /// </summary>
    /// <returns>Progressively higher values (-1 < value < 1) as source transitions starting at Distance.</returns>
    public override double GetValue(double x, double y, double z)
    {
        var    self     = Source0.GetValue(x, y, z);
        double distance = Distance;
        var    res      = (
            (Source0.GetValue(x, y, z + distance) == self ? -1d : 1d) +
            (Source0.GetValue(x, y, z - distance) == self ? -1d : 1d) +
            (Source0.GetValue(x + distance, y, z) == self ? -1d : 1d) +
            (Source0.GetValue(x - distance, y, z) == self ? -1d : 1d)

            ) / 4d; // Get average

        return(res);
    }
Exemple #8
0
 public override double GetValue(double x, double y, double z)
 {
     return(Source0.GetValue(x / Amount, y / Amount, z / Amount));
 }
Exemple #9
0
 public override double GetValue(double x, double y, double z)
 {
     return(Source0.GetValue(x, y, z) > Center ? 1 : -1);
 }