public static float GetValue(int curveId, int pos0_100) { pos0_100 = GlobalFunc.KeepInRange(pos0_100, 0, 100); curveId = GlobalFunc.KeepInRange(curveId, 0, GlobalVar.maxNonLinearCurves - 1); float result; try { result = curves[curveId, pos0_100]; } catch { result = pos0_100; } return(result); }
public static double GetValue0_1(int curveId, double pos0_1) { double pos = pos0_1 * 100; int pos0_100 = (int)pos; int pos0_101 = pos0_100++; pos0_100 = GlobalFunc.KeepInRange(pos0_100, 0, 100); pos0_101 = GlobalFunc.KeepInRange(pos0_101, 0, 100); curveId = GlobalFunc.KeepInRange(curveId, 0, GlobalVar.maxNonLinearCurves - 1); double result; try { float v1 = curves[curveId, pos0_100]; float v2 = curves[curveId, pos0_101]; result = (v1 + (pos - pos0_1) * (v2 - v1)) / 100d; } catch { result = pos0_100; } return(result); }