Module: Astronoby::Util::Trigonometry

Defined in:
lib/astronoby/util/trigonometry.rb

Class Method Summary collapse

Class Method Details

.adjustement_for_arctangent(y, x, angle) ⇒ Object

Source:

Title: Celestial Calculations
Author: J. L. Lawrence
Edition: MIT Press
Chapter: 4 - Orbits and Coordinate Systems


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/astronoby/util/trigonometry.rb', line 12

def adjustement_for_arctangent(y, x, angle)
  return angle if y.positive? && x.positive?

  if y.negative? && x.positive?
    return Angle.from_degrees(
      angle.degrees + Constants::DEGREES_PER_CIRCLE
    )
  end

  Angle.from_degrees(angle.degrees + Constants::DEGREES_PER_CIRCLE / 2)
end