Skip to content

Instantly share code, notes, and snippets.

@Elmuti
Created December 10, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elmuti/e71eb076d411c34a81a6d5540e617a0c to your computer and use it in GitHub Desktop.
Save Elmuti/e71eb076d411c34a81a6d5540e617a0c to your computer and use it in GitHub Desktop.
local function GetAlphaFromToD(tod)
local ret = 0
if tod >= 0 and tod < 6 then
return 0
elseif tod >= 6 and tod < 9 then
ret = (0.5 * math.cos((2/6*math.pi)*tod+math.pi)) + 2.5
elseif tod >= 9 and tod < 18 then
ret = 3
elseif tod >= 18 and tod < 21 then
ret = (-0.5 * math.cos((2/6*math.pi)*tod+math.pi)) + 2.5
elseif tod >= 21 then
return 0
end
return ret - 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment