## Copyright (C) 2016
## 
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 3 of the License, or (at your option) any later
## version.
## 
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
## 
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.
 
## -*- texinfo -*-
## @deftypefn  {Function File} {@var{semimajoraxis} =} majaxis (@var{semiminoraxis}, @var{ecc}) 
## 
## This will return the semimajor axis given
## the semiminoraxis (b) and eccentricity (e)
## From https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84
## earth_a=6378137 m
## earth_b=6356752.314245 m
## earth_eccentricity=.081819221456
## 
## @example
## >> a = majaxis(6356752.314245, .081819221456)
## a =   6378137.01608321
## @end example
## 
## @seealso{minaxis} 
## @end deftypefn

function a=majaxis(b, e)
  ## The equation is b=a*√(1-e^2)
  ## rearranging a=b/√(1-e^2)
  a = b / sqrt(1 - e ^ 2);
  endfunction

