Class: Daylight::DeclinationOfEarth
- Inherits:
-
Object
- Object
- Daylight::DeclinationOfEarth
- Defined in:
- lib/trigger_switch_d/daylight.rb
Overview
Calculates declination of earth
Constant Summary collapse
- Obliquity_of_the_Ecliptic_for_Earth_in_rad =
:nodoc:all
23.45 * Math::PI/180.0
Instance Method Summary collapse
-
#initialize(angle_as_rad) ⇒ DeclinationOfEarth
constructor
A new instance of DeclinationOfEarth.
- #to_f ⇒ Object
Constructor Details
#initialize(angle_as_rad) ⇒ DeclinationOfEarth
Returns a new instance of DeclinationOfEarth.
51 52 53 |
# File 'lib/trigger_switch_d/daylight.rb', line 51 def initialize(angle_as_rad) @declination = Math.asin(Math.sin(angle_as_rad) * Math.sin(Obliquity_of_the_Ecliptic_for_Earth_in_rad)) end |
Instance Method Details
#to_f ⇒ Object
54 55 56 |
# File 'lib/trigger_switch_d/daylight.rb', line 54 def to_f @declination end |