function h=make_arw(xdata,ydata)

% function h=make_arw(xdata,ydata)
%
% This function is used in conjunction with FD3.  Given the 'xdata' and 
% 'ydata' for a stream, it creates an arrow at the end of the stream segment
% designated by the second-to-last and last xdata/ydata points.  The handle
% of the arrow, 'h', is returned.   See also 'adj_arw'.
%
% ACP

% Last update:  July 7, 1993
% Author:       Adrian C. Penisson

global FD3SCALE

len=length(xdata);

% Get angle of last stream segment

dy=ydata(len-1)-ydata(len);
dx=xdata(len-1)-xdata(len);

theta=atan2(dy,dx);

% Get angles of arrow sieds

theta1=theta+pi/6;
theta2=theta-pi/6;

arrowx=xdata(len)+[0 cos(theta1)*FD3SCALE/2 cos(theta2)*FD3SCALE/2];
arrowy=ydata(len)+[0 sin(theta1)*FD3SCALE/2 sin(theta2)*FD3SCALE/2];

% Make arrow

h=patch(arrowx,arrowy,'w');



