C SUBROUTINE TO CALCULATE NEW COORDINATES FOR INTERSECTION
C				BY S. MIDDLESTADT
C				   DEPT. OF SYSTEMS DESIGN
	SUBROUTINE NEWPTS
	REAL INCEPT
	COMMON /LIMITS/XMIN,XMAX,YMIN,YMAX
	COMMON /INTERN/ISW1,ISW2,ISW3,ISW4,ISW5,X,Y,XSTART,
	1XEND,YSTART,YEND,XBEGIN,YBEGIN,XFINAL,YFINAL
	ISW4=0
C DETERMINE NUMBER OF INTERSECTIONS REQUIRED
	IF(ISW1.NE.0.AND.ISW2.NE.0)GO TO 100
	IF(ISW1)10,10,20
10	XSTART=XBEGIN
	YSTART=YBEGIN
	GO TO 101
20	XEND=XFINAL
	YEND=YFINAL
	GO TO 101
100	ISW4=1
101	ISW5=0
	DELTAX=XFINAL -XBEGIN
	DELTAY=YFINAL-YBEGIN
	X=XMIN
103	IF((X.LE.XFINAL.AND.X.GE.XBEGIN).OR.(X.LE.XBEGIN
	1.AND.X.GE.XFINAL))GO TO 104
	GO TO 130
104	IF(DELTAY)105,120,105
105	IF(DELTAX)110,130,110
110	Y=YBEGIN+DELTAY*((X-XBEGIN)/DELTAX)
	IF((Y.GE.YBEGIN.AND.Y.LE.YFINAL).OR.(Y.GE.YFINAL
	1.AND.Y.LE.YBEGIN))GO TO 115
	GO TO 130
115	IF(Y.GE.YMIN.AND.Y.LE.YMAX)GO TO 125
	GO TO 130
120	Y=YBEGIN
125	CALL SET
	IF(ISW5.EQ.1)GO TO 300
130	IF(X.EQ.XMAX)GO TO 135
	X=XMAX
	GO TO 103
135	Y=YMIN
136	IF((Y.LE.YFINAL.AND.Y.GE.YBEGIN).OR.(Y.LE.
	1YBEGIN.AND.Y.GE.YFINAL))GO TO 138
	GO TO 165
138	IF(DELTAX)140,155,140
140	IF(DELTAY)145,165,145
145	X=XBEGIN+DELTAX*((Y-YBEGIN)/DELTAY)
	IF((X.GE.XBEGIN.AND.X.LE.XFINAL).OR.(X.GE.XFINAL.AND.
	1X.LE.XBEGIN))GO TO 150
	GO TO 165
150	IF(X.GE.XMIN.AND.X.LE.XMAX)GO TO 160
	GO TO 165
155	X=XBEGIN
160	CALL SET
	IF(ISW5.EQ.1)GO TO 300
165	IF(Y.EQ.YMAX)GO TO 230
	Y=YMAX
	GO TO 136
230	ISW3=1
300	RETURN
	END
