Class: Geodesics::CentralAngles::Spherical

Inherits:
Object
  • Object
show all
Defined in:
lib/geodesics/central_angles/spherical.rb

Overview

Instance Method Summary collapse

Instance Method Details

#call(point1, point2) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/geodesics/central_angles/spherical.rb', line 7

def call(point1, point2)
  Math.acos(
    Math.sin(point1.latitude) * Math.sin(point2.latitude) +
    Math.cos(point1.latitude) * Math.cos(point2.latitude) *
    Math.cos((point1.longitude - point2.longitude).abs)
  )
end