00001 00002 c 00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993, 00004 c by Steve McMillan, Drexel University, Philadelphia, PA. 00005 c 00006 c All rights reserved. 00007 c 00008 c Redistribution and use in source and binary forms are permitted 00009 c provided that the above copyright notice and this paragraph are 00010 c duplicated in all such forms and that any documentation, 00011 c advertising materials, and other materials related to such 00012 c distribution and use acknowledge that the software was developed 00013 c by the author named above. 00014 c 00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00018 c 00019 00020 00021 subroutine arrow(xtail,ytail,xhead,yhead,mode) 00022 save 00023 c 00024 c Draw arrow from (x,y)-tail to (x,y)-head. 00025 c If mode = 0, x and y are user units. 00026 c If mode = 1, x and y are in inches. 00027 c 00028 common/scales/xl,xr,dinchx,ybot,ytop,dinchy,rlen,slen 00029 data open,pi/.5236,3.141593/head_size/-1.0/ 00030 00031 if(mode.eq.0)then 00032 rtail=(xtail-xl)*dinchx 00033 stail=(ytail-ybot)*dinchy 00034 dr=(xhead-xtail)*dinchx 00035 ds=(yhead-ytail)*dinchy 00036 else 00037 rtail=xtail 00038 stail=ytail 00039 dr=xhead-xtail 00040 ds=yhead-ytail 00041 end if 00042 00043 c Draw the shaft of the arrow. 00044 00045 theta=atan2(ds,dr) 00046 call plot(rtail,stail,3) 00047 00048 rhd=rtail+dr 00049 shd=stail+ds 00050 call plot(rhd,shd,2) 00051 00052 c Draw the point, scaled to shaft size if not otherwise specified. 00053 00054 alpha=theta+pi-open 00055 shaft=sqrt(dr*dr+ds*ds) 00056 00057 if (head_size.le.0.0) then 00058 if(shaft.gt.1.)then 00059 point=.15*shaft 00060 else if(shaft.lt..5)then 00061 point=max(.05,.2*shaft) 00062 else 00063 point = 2.*(shaft-.5)*.15*shaft 00064 & + 2.*(1.-shaft)*max(.05,.2*shaft) 00065 end if 00066 else 00067 point = head_size 00068 end if 00069 00070 r=rhd+point*cos(alpha) 00071 s=shd+point*sin(alpha) 00072 call plot(r,s,2) 00073 call plot(rhd,shd,3) 00074 alpha=alpha+2.*open 00075 r=rhd+point*cos(alpha) 00076 s=shd+point*sin(alpha) 00077 call plot(r,s,2) 00078 00079 return 00080 00081 entry set_arrow_head(size) 00082 00083 c Specify arrowhead size, in "inches". 00084 00085 head_size = size 00086 00087 end