    	SUBROUTINE IFPOLY( NS, IR, ARRAY )
C
C  PROGRAMMER: R.S. ZHOU		MARCH-1986
C
C	THIS ROUTINE DRAWS A POLYGON.
C
C	NS --------- NUMBER OF SIDES/EDGES.
C	IR --------- LENGTH OF "ARRAY".
C	ARRAY(1) --- DIAMETER OF POLYGON IN INCHES.
C	ARRAY(2) --- BORDER WIDTH (INWARD) IN INCHES.
C	ARRAY(3) --- X-COORDINATE OF THE CENTER IN INCHES.
C	ARRAY(4) --- Y-COORDINATE OF THE CENTER IN INCHES.
C	ARRAY(5) --- ROTATION ANGLE OF OBJECT IN DEGREES FROM X-AXIS.
C
    	PARAMETER	D2R = 0.17453292E-1
     	DIMENSION	ARRAY(1)
C
C  INITIALIZE...
C
     	NSD = NS
     	IF( NSD.LT.3 ) NSD = 3
     	IRR = IR
     	RAD = 0.5
     	WID = 0.0
     	XPS = 0.0
     	YPS = 0.0
     	ANG = 0.0
     	IF( IRR.GT.0 .AND. ARRAY(1).NE.0.0 ) RAD = 0.5*ABS(ARRAY(1))
     	IF( IRR.GT.1 .AND. ARRAY(2).NE.0.0 ) THEN
     	    WID = ABS(ARRAY(2))
     	    IF( WID.GE.RAD ) WID = 0.0
     	ENDIF
     	IF( IRR.GT.3 ) THEN
     	    XPS = ARRAY(3)
     	    YPS = ARRAY(4)
     	ENDIF
     	IF( IRR.GT.4 ) ANG = AMOD( ARRAY(5), 360.0 )
C
C  MOVE ORIGIN TO (XPS,YPS) ...
C
     	IF( IRR.GT.3 ) CALL IFPLOT( XPS, YPS, -9 )
C
C  SET ROTATION IF AT ALL...
C
     	IF( IRR.GT.4 .AND. ANG.NE.0.0 ) THEN
     	    CALL IFROTA_NOW( XANG, YANG )
     	    CALL IFROTA( ANG+XANG, ANG+YANG )
     	ENDIF
C
C  START THE DRAWING...
C
111	CALL IFPLOT( 0.0, RAD, 3 )
     	ANGC = 360.0/NSD
     	DO  I = 1, NSD
     	    XPS = RAD*COS((I*ANGC+90.0)*D2R)
     	    YPS = RAD*SIN((I*ANGC+90.0)*D2R)
     	    CALL IFPLOT( XPS, YPS, 2 )
     	ENDDO
     	IF( WID.EQ.0.0 ) GOTO 222
     	RAD = RAD - WID/COS(0.5*ANGC*D2R)
     	WID = 0.0
     	GOTO 111
C
C  RESTORE...
C
222	CALL IFPLOT( 0.0, 0.0, 3 )
     	IF( IRR.GT.4 .AND. ANG.NE.0.0 ) CALL IFROTA( XANG, YANG )
     	IF( IRR.GT.3 ) CALL IFPLOT( -ARRAY(3), -ARRAY(4), -9 )

999	RETURN
    	END
