Class: GeographicLib::Geodesic

Inherits:
Object
  • Object
show all
Defined in:
lib/geographiclib.rb,
ext/geographiclib/geographiclib.cpp

Constant Summary collapse

WGS84 =

An instance of Geodesic initialized with the parameters for the WGS84 ellipsoid.

Geodesic.new(Constants::WGS84_a, Constants::WGS84_f).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a, f) ⇒ Geodesic

Creates an ellipsoid with semi-major-axis a and flattening f.



8
9
10
11
# File 'lib/geographiclib.rb', line 8

def initialize a, f
  @a = a
  @f = f
end

Instance Attribute Details

#aObject

Returns the value of attribute a.



5
6
7
# File 'lib/geographiclib.rb', line 5

def a
  @a
end

#fObject

Returns the value of attribute f.



5
6
7
# File 'lib/geographiclib.rb', line 5

def f
  @f
end

Instance Method Details

#direct(lat1, lon1, azi1, arcmode, s12_a12) ⇒ Object

Calculates the direct geodesic problem given a point, an azimuth and a distance. If arcmode is false, the distance is in meters, otherwise it is an angle.



15
16
17
# File 'lib/geographiclib.rb', line 15

def direct lat1, lon1, azi1, arcmode, s12_a12
  Geodesic.direct @a, @f, lat1, lon1, azi1, !!arcmode, s12_a12
end

#inverse(lat1, lon1, lat2, lon2) ⇒ Object

Calculates the inverse geodesic problem given two points.



20
21
22
# File 'lib/geographiclib.rb', line 20

def inverse lat1, lon1, lat2, lon2
  Geodesic.inverse @a, @f, lat1, lon1, lat2, lon2
end