C       COMPILE USING THE WATRAN COMPILER
C       DUE TO SOME RESTRICTIONS IN WATRAN, CONSTANTS
C       CANNOT BE USED IN ARGUEMENT LIST.
C       (PRODUCING ERROR ON RETURN TO MAIN PROGRAM)
C
C
C     NAME - STDRW         "STEREOSCOPIC DISPLAY ROUTINE"
C
C              BY  BRIAN ARMBRUSTER     SYSTEMS DESIGN ENGINEERING
C                  MIKE LAPRES          UNIVERSITY OF WATERLOO
C                  DON SHAW             APRIL, 1974
C
C
C     PURPOSE - 'STDRW' CALLS 'VECTOR' AND 'DISPLY' IN ORDER TO  DISPLAY
C               THE LEFT AND RIGHT STEREOSCOPIC IMAGES CALCULATED
C               BY "STMAP". EACH IMAGE IS DISPLAYED ON ONE HALF 
C               THE SCREEN (LEFT & RIGHT) FOR VIEWING WITH THE
C               STEREOSCOPIC VIEWER.
C
C
C     CALLING SEQUENCE
C
C          ---
C          INTEGER IVECT(1000),IFIRST,MID,LAST,INT,ISPACE
C          REAL XMIN,XMAX,YMIN,YMAX
C          ---
C          COMMON /FRAME/XMIN,XMAX,YMIN,YMAX
C          ---
C          <COMMENT: "STMAP" MUST BE CALLED>
C          ---
C          CALL STDRW(IVECT,IFIRST,MID,LAST,INT,ISPACE)
C          ---
C
C
C     ARGUMENT DESCRIPTION
C
C       IVECT      )
C       IFIRST     )  EXACTLY AS IN VECTOR
C       INT        )
C       ISPACE     )
C
C       FRAME       COMMON AREA DEFINING THE LIMITS OF THE DISPLY
C                   AREA FOR EACH IMAGE. ALTHOUGH EACH IMAGE HAS
C                   THE SAME WINDOW DEFINED THEY ARE DISPLAYED
C                   ON DIFFERENT HALVES OF THE SCREEN.
C
C       XMIN       )
C       XMAX       )  THE LEFT, RIGHT, BOTTOM AND TOP LIMITS OF THE
C       YMIN       )  DISPLAY AREA.
C       YMAX       )
C                 NOTE 1: SINCE THE CRT MUST BE DIVIDED INTO TWO
C                         HALVES THE RANGE FOR THE X CO-ORDINATES
C                         SHOULD BE ONE HALF THE RANGE OF THE 
C                         Y CO-ORDNATE SO THAT THERE IS NOT A
C                         DIFFERENCE IN SCALE ON THE TWO AXES.
C
C       MID         RETURNED BY 'STDRW': THE LAST USED LOCATION
C                   IN 'IVECT' FOR THE LEFT IMAGE.
C
C       LAST        RETURNED BY 'STDRW': THE LAST USED LOCATION
C                   IN 'IVECT' FOR THE RIGHT IMAGE.
C
C                 NOTE 2: MID+1 IS THE FIRST LOCATION IN
C                         'IVECT' OF THE RIGHT IMAGE.
C                 NOTE 3: IF THE FILES IN IVECT ARE TO BE DRAWN
C                         AGAIN THEY MUST BE REFERENCED BY TWO CALLS
C                         TO 'DRAW'. ONE FROM 'FIRST' TO 'MID' AND ONE
C                         FROM 'MID'+1 TO 'LAST'.
C
C
C
      SUBROUTINE STDRW(IVECT,IFIRST,MID,LAST,INT,ISPACE)
      INTEGER IVECT(1000)
C
C 2-D STEREOSCOPIC DATA FROM 'STMAP'
      COMMON/IMAGE/ILSTRT,ILEND,IRSTRT,IREND,PICT(4,120)
C
      COMMON/FRAME/A,B,C,D
      COMMON/LIMITS/Q,R,S,T
C
C FOR Y CO-ORDINATE ASSSIGN THE SAME VALUES TO THE
C SCREEN LIMITS AS THOSE FOR THE DISPLAY AREA.
      S=C
      T=D
C
C SHIFT SCREEN LIMITS TO THE RIGHT FOR THE LEFT IMAGE
      Q=A
      R=B*2.-A
C
C CALCULATE DISPLAY FILES FOR THE LEFT IMAGE
      CALL VECTOR(2,PICT,ILSTRT,ILEND,IVECT,IFIRST,MID,
     *INT,ISPACE,.FALSE.)
C
C SHIFT SCREEN LIMITS TO THE LEFT FOR THE RIGHT IMAGE
      Q=A*2.-B
      R=B
C
C CALCULATE DISPLAY FILES FOR THE RIGHT IMAGE
      CALL VECTOR(2,PICT,IRSTRT,IREND,IVECT,MID+1,LAST,
     *INT,ISPACE,.FALSE.)
C
C DISPLY IMAGES
      CALL DRAW(IVECT,1,MID)
      CALL DRAW(IVECT,MID+1,LAST)
      RETURN
      END
