%function [lat,lon] = reckonTrackline(lat0,lon0,rng1,rng2,az)
%function [lat,lon] = reckonTrackline(lat0,lon0,rng1,rng2,az,nGps)
function [lat,lon] = reckonTrackline(lat0,lon0,rng1,rng2,az,nGps)

geoid = selectGeoid;
if nargin == 5,
	[lat(1,1) lon(1,1)] = reckon('rh',lat0,lon0,rng1,az+180,geoid);
	lat(2,1) = lat0;
	lon(2,1) = lon0;
	[lat(3,1) lon(3,1)] = reckon('rh',lat0,lon0,rng2,az,geoid);
	[lat(4,1) lon(4,1)] = reckon('rh',lat(3,1),lon(3,1),rng1,az,geoid);
else
	lat = [];
	lon = [];
	nlat = [0; 0; lat0; 0];
	nlon = [0; 0; lon0; 0];
	rng = rng2/max(nGps,1);
	for i=1:max(nGps,1),
		[nlat,nlon] = reckonTrackline(nlat(3),nlon(3),rng1,rng,az);
		lat = [lat; nlat];
		lon = [lon; nlon];
	end
end