4	SUBROUTINE CIRCUS (RR,A1,A2,DD,  RP,ASTART,ADEL,NC)PC_Titl  CIRCUS draws arc or circle with of fewest segments for desired precisionC_ArgsG	REAL RR	    !  [I] radius in inches; if  RR negative, arc is drawn in %C			  negative (clockwise) direction.8	REAL A1	    !  [I] arc start (clockwise end), <radians>?	REAL A2	    !  [I] arc stop (counter-clockwise end), <radians>.C			measured counter-clockwise from  +X axis; 'C			if  A1=A2, defaults to full circle.F	REAL DD	    !  [I] allowed deviation in inches [defaults to .01 inch]=	REAL RP	    !  [O] radius to use in plotting discrete chords*	REAL ASTART !  [O] initial angle, radians.	REAL ADEL   !  [O] angular increment, radians,	INTEGER NC  !  [O] number of chords to plot
C_DescriptionNC  The subroutine circus draws a circle with  NC or more arcs.  It determines KC the minimum number required for the desired precision by determining the JC incremental arc length such that a straight segment deviates by plus or BC minus  DD from the true arc, ignoring quantized pen positions.  #C  The maximum chord is 30 degrees.C_Calls  FRSTPT  VECTOR&C_History  197x  HUGH_H._KIEFFER  UCLA*C	84oct25  HUGH_H._KIEFFER  USGS_FlagstaffHC	85nov06  R.GURULE  USGS. convert from  Calcomp calls to  NCAR graphics,C	88oct18  HHK combine  HHK and  RG versionsC_End2      DATA DMIN/.001/		! minimum allowed precision&     &,DASS/.010/		! default precision>     &,NMIN,NMAX/2,10000/	! minimum & maximum number of chords     &,TWOPI/6.2831853/		! 2 piC?                N=NC		! **** description says  NC is output ***		ASTART=A1 	IF( ABS(A1-A2).LE. 0.0001) THEN
		DA=TWOPI		    ELSE
		DA=A2-A1C  get positive arc length0		IF (DA.LT.0.) DA=DA+TWOPI	! arc crosses x-axis
	    ENDIF	IF (RR.LT.0) THEN		ASTART=A2		DA=-DA
	    ENDIF
	D=ABS(DD)	IF (D.LT.DMIN) D=DASS!	R=ABS(RR)		! get positive radius(C  adel = del arc = arc cos((r-d)/(r+d))'	RP=R+D		! radius to use for chord ends(C uses series approximation for cosine; 7	ADEL=4.*SQRT(D/RP)		! arc angle for required precision+	N = 1+DA/ADEL			! number of steps required5	N = MIN0(NMAX,MAX0(N,NC))	! limit number of segments;	ADEL = DA/N	! get sub-multiple of total arc of proper signC6C------------------------------ move to start location	X = RP*COS(ASTART)	Y = RP*SIN(ASTART)%	CALL FRSTPT (X,Y)	! call plot(x,y,3)C plot the chords		DO I=1,N		A = ASTART+ADEL*FLOAT(I)		X = RP*COS(A)		Y = RP*SIN(A)'		CALL VECTOR (X,Y)	! call plot (x,y,2)		ENDDOC	RETURN	END