function [xfac,yfac]=arrow(x,y,u,v,scale,style,origin,bound,colr);
%function
%[xfac,yfac]=arrow(x,y,u,[v],[scale],[style],[origin],[bound],[colr]);
% scale is the units of u and v to equal a 1 cm arrow when plotted on laser
%  default is 1 unit/cm
%  style==0: hollow arrows 
%  style==1: stick arrows
%  style==-1 (default): solid arrows
%  style==-2  thick line arrows
%  style==-3  sticks
%  origin==0: origin in center of arrows: default
%  origin==1: origin at tail end of arrows:
%  scale>0:  regular rectangular
%  scale<0:  square plot
%  bound is the vector [xmin xmax ymin ymax]
%  color==string like 'r' for red
%
% program was obtained from Rocky G.
%
% where Rocky loads arrow vectors "c:\matlab\m\arrow3"
%
load arrow
%
hold on
narg=nargin;
if (length(u)>1)&(length(v)==1)      %complex u
      if exist('style')==1; origin=style; end
      if exist('scale')==1; style=scale; end
      scale=v;
      v=imag(u);
      u=real(u);
            narg=narg+1;
end
if narg<5 
       scale=1;
end
cstr='-';
if narg>=6
      if style==0
         ax=ax2; ay=ay2;
      elseif style==1
         ax=ax3; ay=ay3;
      elseif style==-2
         ax=ax(1:31); ay=ay(1:31);
      elseif style==-3
         ax=ax4; ay=ay4;
      end
      if style>1
         cstr=['-c',int2str(style)];
      end      
end
if narg<7; origin=0; end;
ax=ax+origin/2;
g=find((x(:)~=nan)&(u(:)~=nan)&(v(:)~=nan));
g=g(:);
x=x(g); y=y(g); u=u(g); v=v(g);
x=x(:)'; y=y(:)'; u=u(:)'; v=v(:)';
%obsolete[dx,dy]=sc2dc([0 1],[0,1]);
dx=(bound(2)-bound(1))*.83;
dy=(bound(4)-bound(3))*.83;
if scale<0;
   scale=-scale;
   xfac=(dx/12.46/scale);
else
   xfac=(dx/15.58/scale);
end
yfac=(dy/9.19/scale);
[theta,umag]=directio(u,v);
theta=90-theta;
outx=ax'*umag;
outy=ay'*umag;
[outxr,outyr]=rot(theta,outx,outy);
  outxf=outxr*(xfac); 
  outyf=outyr*(yfac); 
  outxf=outxf + ones(length(outxr),1)*x;
  outyf=outyf + ones(length(outyr),1)*y;
 if nargin>8
  plot(outxf,outyf,cstr,'color',colr)
 else;
  plot(outxf,outyf,cstr)
 end;
 if nargin>7
%  axis(bound);
 end;
