Module: GeoPoint::Calc::Midpoint

Defined in:
lib/geo_point/calc.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.midpoint_to(base_point, point) ⇒ Array

Returns the midpoint between this point and the supplied point. see(#mathforum.org/library/drmath/view/51822.html for derivation)

Parameters:

  • base_point: (GeoPoint)

    Starting point (latitude, longitude)

  • point: (GeoPoint)

    Destination point (latitude, longitude)

Returns:

  • (Array)

    Midpoint between this point and the supplied point



54
55
56
# File 'lib/geo_point/calc.rb', line 54

def self.midpoint_to base_point, point
  GeoPoint.new GeoCalc::Midpoint.midpoint_to(base_point, point).to_coords
end

Instance Method Details

#midpoint_to(point) ⇒ Object



43
44
45
# File 'lib/geo_point/calc.rb', line 43

def midpoint_to point
  GeoPoint.new GeoCalc::Midpoint.midpoint_to(self, point).to_coords
end