Skip to content

Instantly share code, notes, and snippets.

@Cvar1984
Created September 3, 2024 06:53
Show Gist options
  • Save Cvar1984/f98e4ae925bcbf1d7e136a3e2efebef6 to your computer and use it in GitHub Desktop.
Save Cvar1984/f98e4ae925bcbf1d7e136a3e2efebef6 to your computer and use it in GitHub Desktop.
Find alpha degrees for suncalc
local function degrees(radians)
return radians * 180 / math.pi
end
io.write("Height of the pole: ")
local height = io.read("*n")
io.write("Length of the shadow: ")
local wide = io.read("*n")
local tan_alpha = height / wide
local alpha_radian = math.atan(tan_alpha)
local alpha_degree = degrees(alpha_radian)
print("Alpha:", alpha_degree, "deg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment