function latLon = hdg2ll(heading, offset, latIn, lonIn, rE)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Compute the latitude and longitude of a point that is "offset"
% meters in the "heading" direction from the input lat and lon.  This
% computation does not use any projection and therefore is valid for
% very short distances, say less than a kilometer or so.
%
% AUTHOR:  Initial; rsm
% DATE:    06/3/11
%
% Inputs:  heading - offset direction,decimal degrees.
%          offset  - offset distance, meters
%          latIn   - initial location, latitude, decimal degrees.
%          lonIn   - initial location, longitude, decimal degrees.
%          rE      - Earth radius, meters.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% latIn, lonIn, and heading in decimal degrees.
% offset in meters.
%
% units
  latLon(1) = latIn + offset*cos(heading*pi/180)/rE*180/pi;
  latLon(2) = lonIn + offset*sin(heading*pi/180)/rE/cos(latIn*pi/180)*180/pi;
  fprintf('[%.6f %.6f]\n', latLon);
return
%
