      SUBROUTINE PLTCUT(IPLCUT,IX,IY,JX,JY,MINX,MINY,
     1MAXX,MAXY)
C     RENBR(/CLIP PORTION OF LINE OUTSIDE WINDOW)
C
C     DONALD BARTH, CHEMISTRY DEPT., HARVARD UNIVERSITY
C
C     ROUTINE BASED ON GENPLT-II PLOTTER COUPLING
C     ROUTINES PUBLISHED IN VOLUME 3 OF COMPUTER
C     PROGRAMS FOR CHEMISTRY
C
C     IPLCUT = RETURNED AS 0 IF LINE DOES NOT PASS THRU
C              WINDOW.
C            = RETURNED AS 1 IF LINE PASSES THRU WINDOW
C
C     IX     = HORIZONTAL COORDINATE OF START OF LINE
C     IY     = VERTICAL COORDINATE OF START OF LINE
C     JX     = HORIZONTAL COORDINATE OF END OF LINE
C     JY     = VERTICAL COORDINATE OF END OF LINE
C     MINX   = HORIZONTAL COORDINATE OF LOWER LEFT
C              CORNER OF WINDOW
C     MINY   = VERTICAL COORDINATE OF LOWER LEFT CORNER
C              OF WINDOW
C     MAXX   = HORIZONTAL COORDINATE OF UPPER RIGHT
C              CORNER OF WINDOW
C     MAXY   = VERTICAL COORDINATE OF UPPER RIGHT CORNER
C              OF WINDOW
C
C     ROUTINE RETURNS JX, JY, IX AND IY CHANGED IF
C     WINDOWING IS NECESSARY
C
C     TEST IF LINE NEEDS TO BE WINDOWED
      IF(IX-MINX)8,1,1
    1 IF(IX-MAXX)2,2,8
    2 IF(JX-MINX)8,3,3
    3 IF(JX-MAXX)4,4,8
    4 IF(IY-MINY)8,5,5
    5 IF(IY-MAXY)6,6,8
    6 IF(JY-MINY)8,7,7
    7 IF(JY-MAXY)38,38,8
    8 IIX=IX
      IIY=IY
      IJX=JX
      IJY=JY
      MOVEX=JX-IX
      MOVEY=JY-IY
C
C     INTERSECTION WITH LEFT AND RIGHT BORDERS
      IF(IIX-MINX)9,10,10
    9 IIX=MINX
      IF(IJX-MINX)36,14,14
   10 IF(IIX-MAXX)12,12,11
   11 IIX=MAXX
      IF(IJX-MAXX)12,12,36
   12 IF(IJX-MINX)13,14,14
   13 IJX=MINX
      GO TO 16
   14 IF(IJX-MAXX)16,16,15
   15 IJX=MAXX
   16 IF(MOVEX)17,18,17
   17 IIY=IY+((MOVEY*(IIX-IX))/MOVEX)
      IJY=JY-((MOVEY*(JX-IJX))/MOVEX)
C
C     INTERSECTION WITH LOWER AND UPPER BORDERS
   18 IF(IIY-MINY)19,20,20
   19 IIY=MINY
      IF(IJY-MINY)36,24,24
   20 IF(IIY-MAXY)22,22,21
   21 IIY=MAXY
      IF(IJY-MAXY)22,22,36
   22 IF(IJY-MINY)23,24,24
   23 IJY=MINY
      GO TO 26
   24 IF(IJY-MAXY)26,26,25
   25 IJY=MAXY
   26 IF(MOVEY)27,28,27
   27 IIX=IX+((MOVEX*(IIY-IY))/MOVEY)
      IJX=JX-((MOVEX*(JY-IJY))/MOVEY)
   28 IF(IIX-MINX)29,30,30
   29 IIX=MINX
   30 IF(IIX-MAXX)32,32,31
   31 IIX=MAXX
   32 IF(IJX-MINX)33,34,34
   33 IJX=MINX
   34 IF(IJX-MAXX)37,37,35
   35 IJX=MAXX
      GO TO 37
C
C     IPLCUT=0 IF LINE NOT WITHIN WINDOW
   36 IPLCUT=0
      GO TO 39
C
C     IPLCUT=1 IF LINE IS WITHIN WINDOW
   37 JX=IJX
      JY=IJY
      IX=IIX
      IY=IIY
   38 IPLCUT=1
C
C     RETURN TO CALLING PROGRAM
   39 RETURN
C372613660265
      END

