Class: Daylight::DeclinationOfEarth

Inherits:
Object
  • Object
show all
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

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_fObject



54
55
56
# File 'lib/trigger_switch_d/daylight.rb', line 54

def to_f
  @declination
end