      SUBROUTINE CENTRE(*,X1,Y1,X2,Y2,X3,Y3,X4,Y4,CENTER)
      DIMENSION CENTER(2)
      IF (X1.NE.X3.OR.X2.NE.X4) GO TO 10
      CENTER(1)=X1
      CENTER(2)=(AMAX1(Y1,Y2,Y3,Y4)+AMIN1(Y1,Y2,Y3,Y4))/2.0
      RETURN 1
   10 IF (X1.NE.X3) GO TO 20
      CENTER(1)=X1
      CENTER(2)=(Y4-Y2)*(CENTER(1)-X2)/(X4-X2)+Y2
      GO TO 100
   20 IF (X2.NE.X4) GO TO 30
      CENTER(1)=X2
      CENTER(2)=(Y3-Y1)*(CENTER(1)-X1)/(X3-X1)+Y1
      GO TO 100
   30 XM1=(Y2-Y4)/(X2-X4)
      XM2=(Y1-Y3)/(X1-X3)
      IF (XM1.EQ.XM2) GO TO 40
      CENTER(1)=(Y1-XM2*X1-(Y2-XM1*X2))/(XM1-XM2)
      CENTER(2)=XM1*(CENTER(1)-X2)+Y2
      GO TO 100
   40 CENTER(1)=(X1+X2)/2.0
      CENTER(2)=(Y1+Y2)/2.0
      RETURN 1
100   CONTINUE
      RETURN
      END
