This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Outside compensation curve
#6
Hello.

You can try this:

Code:
123456789101112131415161718192021222324252627
function linear_by_table(input,curve,offset) local FDY = offset or 0     fk1= (curve["y"][1] - curve["y"][2]) / (curve["x"][1] - curve["x"][2])     fk2= (curve["y"][2] - curve["y"][3]) / (curve["x"][2] - curve["x"][3])     fk3= (curve["y"][3] - curve["y"][4]) / (curve["x"][3] - curve["x"][4])     if input < curve["x"][1] then         out = curve["y"][1] + FDY;     elseif input >= curve["x"][1] and input < curve["x"][2] then             out = fk1 * (input - curve["x"][1]) + curve["y"][1] + FDY     elseif input >= curve["x"][2] and input < curve["x"][3] then         out = fk2 * (input - curve["x"][2]) + curve["y"][2] + FDY     elseif input >= curve["x"][3] and input < curve["x"][4] then             out = fk3 * (input - curve["x"][3]) + curve["y"][3] + FDY     else         out = curve["y"][4] + FDY     end  return out end curve = {} curve["x"] = {-20,-10,0,20} curve["y"] = {80,70,65,18} --offset=2 --log(linear_by_table(20,curve,offset)) log(linear_by_table(-15,curve))
Reply


Messages In This Thread
Outside compensation curve - by oyvindnordbo - 04.12.2018, 07:13
RE: Outside compensation curve - by admin - 04.12.2018, 07:29
RE: Outside compensation curve - by admin - 04.12.2018, 09:20
RE: Outside compensation curve - by Daniel - 04.12.2018, 09:22
RE: Outside compensation curve - by merel - 04.12.2018, 13:45
RE: Outside compensation curve - by admin - 17.01.2025, 08:18

Forum Jump: