28 lines
752 B
Text
28 lines
752 B
Text
on mouseUp
|
|
ask "Enter lng,lat,meridian"
|
|
if it is empty then exit mouseup
|
|
// -150.5, -4.95, -150.0
|
|
put item 1 of it into longitude
|
|
put item 2 of it into latitude
|
|
put item 3 of it into meridian
|
|
|
|
repeat with hour = 6 TO 18
|
|
put 15 *hour - longitude + meridian - 180 into hra
|
|
put rad2deg(atan(sin(deg2rad(latitude)) * tan(deg2rad(hra)))) into hla
|
|
if abs(hra) > 90 then put hla + 180 * sgn(hra *latitude) into hla
|
|
put hour && hra && hla & cr after sunhours
|
|
end repeat
|
|
put sunhours
|
|
end mouseUp
|
|
|
|
function rad2deg theta
|
|
return theta * (180 / pi)
|
|
end rad2deg
|
|
|
|
function deg2rad theta
|
|
return theta * (pi / 180)
|
|
end deg2rad
|
|
|
|
function sgn x
|
|
if x >0 then return 1 else return -1
|
|
end sgn
|