LibNoise.Unity.Operator.Select.GetValue C# (CSharp) Method

GetValue() public method

Returns the output value for the given input coordinates.
public GetValue ( double x, double y, double z ) : double
x double The input coordinate on the x-axis.
y double The input coordinate on the y-axis.
z double The input coordinate on the z-axis.
return double
        public override double GetValue(double x, double y, double z)
        {
            System.Diagnostics.Debug.Assert(this.m_modules[0] != null);
            System.Diagnostics.Debug.Assert(this.m_modules[1] != null);
            System.Diagnostics.Debug.Assert(this.m_modules[2] != null);
            double cv = this.m_modules[2].GetValue(x, y, z);
            double a;
            if (this.m_fallOff > 0.0)
            {
                if (cv < (this.m_min - this.m_fallOff))
                {
                    return this.m_modules[0].GetValue(x, y, z);
                }
                else if (cv < (this.m_min + this.m_fallOff))
                {
                    double lc = (this.m_min - this.m_fallOff);
                    double uc = (this.m_min + this.m_fallOff);
                    a = Utils.MapCubicSCurve((cv - lc) / (uc - lc));
                    return Utils.InterpolateLinear(this.m_modules[0].GetValue(x, y, z), this.m_modules[1].GetValue(x, y, z), a);

                }
                else if (cv < (this.m_max - this.m_fallOff))
                {
                    return this.m_modules[1].GetValue(x, y, z);
                }
                else if (cv < (this.m_max + this.m_fallOff))
                {
                    double lc = (this.m_max - this.m_fallOff);
                    double uc = (this.m_max + this.m_fallOff);
                    a = Utils.MapCubicSCurve((cv - lc) / (uc - lc));
                    return Utils.InterpolateLinear(this.m_modules[1].GetValue(x, y, z), this.m_modules[0].GetValue(x, y, z), a);

                }
                return this.m_modules[0].GetValue(x, y, z);
            }
            else
            {
                if (cv < this.m_min || cv > this.m_max)
                {
                    return this.m_modules[0].GetValue(x, y, z);
                }
                return this.m_modules[1].GetValue(x, y, z);
            }
        }