public static Double Lerp(this Double value, Double min, Double max) { var rho = value.Clamp(0.0, 1.0); var delta = max - min; return(rho * delta + min); }
public static Double Lerp( this Double t, Double from, Double to ) { return(t.Clamp(0, 1) * (to - from) + from); }
/// <summary> /// Updates the progress of this task. /// </summary> /// <param name="progress">The new progress.</param> /// <param name="canFinalize">A value indicating whether the update can trigger a completion.</param> public void UpdateProgress(Double progress, Boolean canFinalize = true) { this.Progress = progress.Clamp(ScheduledTask.MinimumProgress, ScheduledTask.MaximumProgress); if (canFinalize) { if (this.Progress >= this.ProgressCompletionThreshold) { this.IsTaskComplete = true; } } }
public static Double Saturate(this Double v) { return(v.Clamp(0, 1)); }