Lerp() public static method

public static Lerp ( Double t, Double a, Double b ) : Double
t Double
a Double
b Double
return Double
Example #1
0
        public override Double Get(Double x, Double y, Double z, Double w)
        {
            var value     = this.Source.Get(x, y, z, w);
            var falloff   = this.Falloff.Get(x, y, z, w);
            var threshold = this.Threshold.Get(x, y, z, w);

            if (falloff > 0.0)
            {
                if (value < (threshold - falloff))
                {
                    // Lies outside of falloff area below threshold, return first source
                    return(this.Low.Get(x, y, z, w));
                }
                if (value > (threshold + falloff))
                {
                    // Lise outside of falloff area above threshold, return second source
                    return(this.High.Get(x, y, z, w));
                }
                // Lies within falloff area.
                var lower = threshold - falloff;
                var upper = threshold + falloff;
                var blend = Utilities.QuinticBlend((value - lower) / (upper - lower));
                return(Utilities.Lerp(blend, this.Low.Get(x, y, z, w), this.High.Get(x, y, z, w)));
            }

            return(value < threshold?this.Low.Get(x, y, z, w) : this.High.Get(x, y, z, w));
        }
Example #2
0
        public override Double Get(Double x, Double y, Double z, Double w, Double u, Double v)
        {
            var v1    = this.Low.Get(x, y, z, w, u, v);
            var v2    = this.High.Get(x, y, z, w, u, v);
            var blend = this.Source.Get(x, y, z, w, u, v);

            return(Utilities.Lerp(blend, v1, v2));
        }
Example #3
0
        public override Double Get(Double x, Double y)
        {
            var v1    = this.Low.Get(x, y);
            var v2    = this.High.Get(x, y);
            var blend = (this.Source.Get(x, y) + 1.0) * 0.5;

            return(Utilities.Lerp(blend, v1, v2));
        }