1function [latlong, aux] = geodesicdirect(geodesic, a, f)
2%GEODESICDIRECT  Wrapper for geodreckon
3%
4%   [latlong, aux] = GEODESICDIRECT(geodesic)
5%   [latlong, aux] = GEODESICDIRECT(geodesic, a, f)
6%
7%   This is a legacy function to replace a compiled interface function of
8%   the same name.  This now calls geodreckon which is implemented as
9%   native Matlab code.
10%
11%   geodesic is an M x 4 matrix
12%       latitude of point 1 = latlong(:,1) in degrees
13%       longitude of point 1 = latlong(:,2) in degrees
14%       azimuth at point 1 = latlong(:,3) in degrees
15%       distance to point 2 = latlong(:,4) in meters
16%
17%   latlong is an M x 3 matrix
18%       latitude of point 2 = geodesic(:,1) in degrees
19%       longitude of point 2 = geodesic(:,2) in degrees
20%       azimuth at point 2 = geodesic(:,3) in degrees
21%   aux is an M x 5 matrix
22%       spherical arc length = aux(:,1) in degrees
23%       reduced length = aux(:,2) in meters
24%       geodesic scale 1 to 2 = aux(:,3)
25%       geodesic scale 2 to 1 = aux(:,4)
26%       area under geodesic = aux(:,5) in meters^2
27%
28%   a = equatorial radius (meters)
29%   f = flattening (0 means a sphere)
30%   If a and f are omitted, the WGS84 values are used.
31%
32%   See also GEODRECKON.
33
34% Copyright (c) Charles Karney (2015-2017) <charles@karney.com>.
35
36  if (nargin < 2)
37    ellipsoid = defaultellipsoid;
38  elseif (nargin < 3)
39    ellipsoid = [a, 0];
40  else
41    ellipsoid = [a, flat2ecc(f)];
42  end
43  [lat2, lon2, azi2, S12, m12, M12, M21, a12] = geodreckon ...
44      (geodesic(:,1), geodesic(:,2), geodesic(:,4), geodesic(:,3), ...
45       ellipsoid);
46  latlong = [lat2, lon2, azi2];
47  aux = [a12, m12, M12, M21, S12];
48end
49