class SolCal::Commands::HaAngleToZenithCommand

Protected Instance Methods

do_execute() click to toggle source
# File lib/solcal/commands/ha_angle_to_zenith_command.rb, line 5
def do_execute
        a = Math.cos(Angle.from_deg(angle_from_zenith).to_rad)
        b = Math.cos(latitude.to_rad)*Math.cos(declination.to_rad)
        c = Math.tan(latitude.to_rad)*Math.tan(declination.to_rad)
        d = a/b-c
        return nil unless d >= 0 and d<=1
        Angle.from_rad(Math.acos(d))
end