Method: When::Ephemeris::Datum#elongation

Defined in:
lib/when_exe/ephemeris.rb

#elongation(t, target = Sun, base = Earth) ⇒ Numeric

離角 / CIRCLE

Parameters:

Returns:



1104
1105
1106
1107
1108
1109
1110
1111
# File 'lib/when_exe/ephemeris.rb', line 1104

def elongation(t, target=Sun, base=Earth)
  t = +t
  self_coords   = self.coords(t, base)
  target_coords = target.coords(t, base)
  elongation    = acos(self_coords.spherical_law_of_cosines(target_coords)) / CIRCLE
  difference    = (self_coords.phi - target_coords.phi + 0.5) % 1 - 0.5
  return (difference >= 0) ? elongation : -elongation
end