Class: Astronoby::Body
- Inherits:
-
Object
- Object
- Astronoby::Body
- Defined in:
- lib/astronoby/body.rb
Instance Method Summary collapse
-
#initialize(equatorial_coordinates) ⇒ Body
constructor
A new instance of Body.
-
#rising_azimuth(latitude:) ⇒ Object
Source: Title: Celestial Calculations Author: J.
-
#rising_time(latitude:, longitude:, date:) ⇒ Object
Source: Title: Celestial Calculations Author: J.
-
#setting_azimuth(latitude:) ⇒ Object
Source: Title: Celestial Calculations Author: J.
-
#setting_time(latitude:, longitude:, date:) ⇒ Object
Source: Title: Celestial Calculations Author: J.
Constructor Details
#initialize(equatorial_coordinates) ⇒ Body
Returns a new instance of Body.
5 6 7 |
# File 'lib/astronoby/body.rb', line 5 def initialize(equatorial_coordinates) @equatorial_coordinates = equatorial_coordinates end |
Instance Method Details
#rising_azimuth(latitude:) ⇒ Object
Source:
Title: Celestial Calculations
Author: J. L. Lawrence
Edition: MIT Press
Chapter: 5 - Stars in the Nighttime Sky
30 31 32 33 34 35 |
# File 'lib/astronoby/body.rb', line 30 def rising_azimuth(latitude:) ar = azimuth_component(latitude: latitude) return nil if ar >= 1 Angle.acos(ar) end |
#rising_time(latitude:, longitude:, date:) ⇒ Object
Source:
Title: Celestial Calculations
Author: J. L. Lawrence
Edition: MIT Press
Chapter: 5 - Stars in the Nighttime Sky
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/astronoby/body.rb', line 14 def rising_time(latitude:, longitude:, date:) h2_component = h2(latitude: latitude) return nil if h2_component.nil? rising_lst = 24 + @equatorial_coordinates.right_ascension.hours - h2_component.degrees rising_lst -= 24 if rising_lst > 24 Util::Time.lst_to_ut(date: date, longitude: longitude, lst: rising_lst) end |
#setting_azimuth(latitude:) ⇒ Object
Source:
Title: Celestial Calculations
Author: J. L. Lawrence
Edition: MIT Press
Chapter: 5 - Stars in the Nighttime Sky
57 58 59 60 61 62 |
# File 'lib/astronoby/body.rb', line 57 def setting_azimuth(latitude:) rising_az = rising_azimuth(latitude: latitude) return nil if rising_az.nil? Angle.as_degrees(360 - rising_az.degrees) end |
#setting_time(latitude:, longitude:, date:) ⇒ Object
Source:
Title: Celestial Calculations
Author: J. L. Lawrence
Edition: MIT Press
Chapter: 5 - Stars in the Nighttime Sky
42 43 44 45 46 47 48 49 50 |
# File 'lib/astronoby/body.rb', line 42 def setting_time(latitude:, longitude:, date:) h2_component = h2(latitude: latitude) return nil if h2_component.nil? setting_lst = @equatorial_coordinates.right_ascension.hours + h2_component.degrees setting_lst -= 24 if setting_lst > 24 Util::Time.lst_to_ut(date: date, longitude: longitude, lst: setting_lst) end |