Created
December 10, 2019 12:58
-
-
Save Elmuti/e71eb076d411c34a81a6d5540e617a0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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