public override Double Get(Double x, Double y)
{
var value = this.Source.Get(x, y);
var falloff = this.Falloff.Get(x, y);
var threshold = this.Threshold.Get(x, y);
if (falloff > 0.0)
{
if (value < (threshold - falloff))
{
// Lies outside of falloff area below threshold, return first source
return this.Low.Get(x, y);
}
if (value > (threshold + falloff))
{
// Lies outside of falloff area above threshold, return second source
return this.High.Get(x, y);
}
// Lies within falloff area.
var lower = threshold - falloff;
var upper = threshold + falloff;
var blend = MathHelper.QuinticBlend((value - lower) / (upper - lower));
return MathHelper.Lerp(blend, this.Low.Get(x, y), this.High.Get(x, y));
}
return (value < threshold ? this.Low.Get(x, y) : this.High.Get(x, y));
}