SUBR	ARCARROW,XP,YP,X,Y,SIZE,BOW,ISIDE
;first coord. set (XP,YP) is base and (X,Y) is point
;size is the size of the arrow point
;bow is the ratio of chord length to "bow" (partial radius)
;bow is .5 for a semi-circle
;iside controls which direction arrow is curved
	SPHI=.316	CPHI=.949	RAR=.009268
	IF (!NARG NE 7) THEN BEGIN
	TYPE,'wrong # of arguments for arcarrow'
	RETURN
	END
;get the radius of the arc
	IF BOW GT .5 OR BOW LE 0 THEN { TYPE,'illegal bow in arcarrow =',bow
	RETURN }
	DX=X-XP		DY=Y-YP
	D=SQRT(DX*DX+DY*DY)
	R=D*(.25+BOW*BOW)*.5/BOW
;now get the coord. of the center
	X0=.5*D
	IF (ISIDE NE 1 AND ISIDE NE -1) THEN {
	TYPE,'iside must be 1 or -1 in arcarrow'
	RETURN		}
	Y0=ISIDE*(R-BOW*D)
	TH=ATAN2(DY,DX)
	XQ=X0*COS(TH)-Y0*SIN(TH)
	YQ=Y0*COS(TH)+X0*SIN(TH)
	X0=XQ
	Y0=YQ
	X0=X0+XP
	Y0=Y0+YP
;	XYMOV,X,Y,-4  XYMOV,XP,YP,-4  XYMOV,X0,Y0,-4
;now get the 2 spanning angles
	TH2=ATAN2( (Y-Y0), (X-X0) )
	TH1=ATAN2( (YP-Y0),(XP-X0))
	DT=(TH2-TH1)
;always find the shortest direction
	IF ABS(DT) GT #PI THEN {
		IF DT GT 0 THEN DT=DT-#2PI
		IF DT LT 0 THEN DT=-#2PI-DT	}
	DT=DT/30.
;draw the arc
	XQ=R*COS(TH1)+X0	YQ=R*SIN(TH1)+Y0
	XYMOV,XQ,YQ,0
	FOR I=1,30 DO BEGIN
	TH=TH1+DT*I
	XQ=R*COS(TH)+X0		YQ=R*SIN(TH)+Y0
	XYMOV,XQ,YQ,1
	END
;use a modified TH2 to get away from tip and toward tail
	XQ=RAR*SIZE/R
	IF DT LT 0 THEN TH2=TH2+XQ ELSE TH2=TH2-XQ
	XQ=-CPHI*COS(TH2)*ISIDE
	YQ=SPHI*SIN(TH2)*ISIDE
	ZQ=RAR*SIZE*2
	Y3=Y+ZQ*(XQ+YQ)
	Y4=Y+ZQ*(XQ-YQ)
	XQ=CPHI*SIN(TH2)*ISIDE
	YQ=-SPHI*COS(TH2)*ISIDE
	X3=X+ZQ*(XQ-YQ)
	X4=X+ZQ*(XQ+YQ)
	XYMOV,X3,Y3,1
	XYMOV,X,Y,0
	XYMOV,X4,Y4,1
	XYMOV,X,Y,0
ENDSUBR
