function [xfac,yfac]=arrow2(x,y,u,v,scale,style,origin);
%function [xfac,yfac]=arrow2(x,y,u,v,[scale],[style],[origin]);
% 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
%  styly==-2  thick line arrows
%  origin==0: origin in center of arrows: default
%  origin==1: origin at tail end of arrows:
%  scale>0:  regular rectangular
%  scale<0:  square plot
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);
      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(:)';
[dx,dy]=sc2dc([0 1],[0,1]);
dx=diff(dx)*0.83;
dy=diff(dy)*0.83;
if scale<0;
   scale=-scale;
   xfac=dx/12.46/scale;
else
   xfac=dx/15.58/scale;
end
yfac=dy/9.19/scale;
theta=angled(u+i*v);
umag=abs(u+i*v);
[outx,outy]=rot(ax'*umag,ay'*umag,ones(length(ax),1)*theta);
outx=outx*xfac+ones(ax')*x;
outy=outy*yfac+ones(ay')*y;
plot(outx,outy,cstr)
