protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { var v01 = UMath.Clamp(0, 1, UMath.InverseLerp(inMin, inMax, inputValue)); var vC = curve.Evaluate((float)v01); return(UMath.Lerp(outMin, outMax, vC)); }
/// <summary> /// output[i] = input[i]*scale + offset /// </summary> /// <param name="array"></param> /// <param name="scale"></param> /// <param name="offset"></param> /// <returns></returns> public static int[] ToRGBArray(double[] array, double scale, double offset) { int[] result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = (int)UMath.Clamp(array[i] * scale + offset, 0.0, 255.0); } return(result); }
private void OnEachActionFinish(Exception e, int id) { if (e != null) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); _context.RequestExit(); this.Close(); this.Dispose(); } else { ProgressBar.Value = (int)(UMath.Clamp(m_sequence.progress, 0.0f, 1.0f) * 100); } }
protected override double ExecuteFilter(double x, double y, double z, CallableNode flow, double inputValue) { return(UMath.Clamp(min, max, inputValue)); }