      SUBROUTINE TICS(X,Y,Z,III,JJJ,IB1,IB2,TAILLE,INUM)
C
      INCLUDE 'com_options.f'
      COMMON / LOCALTIC / XP(8),YP(8),XMID,YMID
C
      REAL*4 X(*),Y(*),Z(*)
C
      SENS = REAL(ISENS)
      XXM = 0.
      YYM = 0.
      ZZM = 0.
      DO I=1,8
        CALL PROJEC(X(I),Y(I),Z(I),SENS,XP(I),YP(I),IPERSP,XPUP,DIST)
        XXM = XXM+X(I)
        YYM = YYM+Y(I)
        ZZM = ZZM+Z(I)
      ENDDO
      XXM = XXM*0.125
      YYM = YYM*0.125
      ZZM = ZZM*0.125
      CALL PROJEC(XXM,YYM,ZZM,SENS,XMID,YMID,IPERSP,XPUP,DIST)   
C
      IF (III.NE.IB1.AND.JJJ.NE.IB1.AND.III.NE.IB2.AND.JJJ.NE.IB2) THEN
        II = MIN(III,JJJ)
        JJ = MAX(III,JJJ)
        IF (II.EQ.1) THEN
          IF (JJ.EQ.2) THEN
            CALL TICTIC(PROPX,XECH,NECHX,X,Y,Z,2,1,TAILLE,INUM,ILOGX)
          ELSEIF(JJ.EQ.4) THEN                    
            CALL TICTIC(PROPY,YECH,NECHY,X,Y,Z,4,1,TAILLE,INUM,ILOGY)
          ELSE                                    
            CALL TICTIC(PROPZ,ZECH,NECHZ,X,Y,Z,1,5,TAILLE,INUM,ILOGZ)
          ENDIF                                   
        ELSEIF(II.EQ.2) THEN                      
          IF (JJ.EQ.3) THEN                       
            CALL TICTIC(PROPY,YECH,NECHY,X,Y,Z,3,2,TAILLE,INUM,ILOGY)
          ELSE                                    
            CALL TICTIC(PROPZ,ZECH,NECHZ,X,Y,Z,2,6,TAILLE,INUM,ILOGZ)
          ENDIF                                   
        ELSEIF(II.EQ.3) THEN                      
          IF (JJ.EQ.4) THEN                       
            CALL TICTIC(PROPX,XECH,NECHX,X,Y,Z,3,4,TAILLE,INUM,ILOGX)
          ELSE                                    
            CALL TICTIC(PROPZ,ZECH,NECHZ,X,Y,Z,3,7,TAILLE,INUM,ILOGZ)
          ENDIF                                   
        ELSEIF(II.EQ.4) THEN                      
            CALL TICTIC(PROPZ,ZECH,NECHZ,X,Y,Z,4,8,TAILLE,INUM,ILOGZ)
        ELSEIF(II.EQ.5) THEN                      
          IF (JJ.EQ.6) THEN                       
            CALL TICTIC(PROPX,XECH,NECHX,X,Y,Z,6,5,TAILLE,INUM,ILOGX)
          ELSE                                    
            CALL TICTIC(PROPY,YECH,NECHY,X,Y,Z,8,5,TAILLE,INUM,ILOGY)
          ENDIF                                   
        ELSEIF(II.EQ.6) THEN                      
            CALL TICTIC(PROPY,YECH,NECHY,X,Y,Z,7,6,TAILLE,INUM,ILOGY)
        ELSE                                      
            CALL TICTIC(PROPX,XECH,NECHX,X,Y,Z,7,8,TAILLE,INUM,ILOGX)
        ENDIF
      ENDIF
      END
C-----------------------------------------------------------------------
      SUBROUTINE TICTIC(PROP,ECH,NN,X,Y,Z,I,J,TAILLE,INUM,ILOG)
C
      INCLUDE 'com_options.f'
      COMMON / LOCALTIC / XP(8),YP(8),XMID,YMID
C
      REAL*4 X(*),Y(*),Z(*),PROP(*)
      REAL*8 ECH(*)
      CHARACTER*40 CC
      INTEGER IVOIS(3,8)
      DATA IVOIS / 2,4,5 , 1,3,6 , 2,4,7 , 1,3,8
     &           , 1,6,8 , 2,5,7 , 3,6,8 , 4,5,7 /
C
      SENS = REAL(ISENS)
C
      III = 0
      JJJ = 0
      INUMNUM = MOD(INUM,10)
      ITIC = INUM/10
      IF (INUMNUM.EQ.0) CALL ASFCOL(ICOLAX)
      SCALMIN1 = 1.
      SCALMIN2 = 1.
      DO K=1,3
        II = IVOIS(K,I)
        IF (II.NE.J) THEN
          TOTO = SQRT(((XP(J)-XP(I))**2  + (YP(J)-YP(I))**2)
     &               *((XP(II)-XP(I))**2 + (YP(II)-YP(I))**2) )
          IF (TOTO.NE.0.) THEN
            SC = ( (XP(J)-XP(I))*(XP(II)-XP(I)) 
     &           + (YP(J)-YP(I))*(YP(II)-YP(I)) )/TOTO
            IF (ABS(SC).LT.SCALMIN1) THEN
              III = II
              SCALMIN1 = ABS(SC)
            ENDIF
          ENDIF
        ENDIF
        JJ = IVOIS(K,J)
        IF (JJ.NE.I) THEN
          TOTO = SQRT(((XP(I)-XP(J))**2  + (YP(I)-YP(J))**2)
     &               *((XP(JJ)-XP(J))**2 + (YP(JJ)-YP(J))**2) )
          IF (TOTO.NE.0.) THEN
            SC = ( (XP(I)-XP(J))*(XP(JJ)-XP(J)) 
     &           + (YP(I)-YP(J))*(YP(JJ)-YP(J)) )/TOTO
            IF (ABS(SC).LT.SCALMIN2) THEN
              JJJ = JJ
              SCALMIN2 = ABS(SC)
            ENDIF
          ENDIF
        ENDIF
      ENDDO      
      IF (III.EQ.0) THEN
CC        PRINT*,'ATTENTION IIIJJJ',III,SCALMIN
CC        CALL GSCHAR(X(I),Y(I),9,'ATTENTION')
CC        CALL GSCHAR(X(J),Y(J),9,'ATTENTION')
        RETURN
      ENDIF
      DIR1_1 = XP(III)-XP(I)
      DIR1_2 = YP(III)-YP(I)
      DIR2_1 = XP(JJJ)-XP(J)
      DIR2_2 = YP(JJJ)-YP(J)
      TTT = TAILLE*3.
      IF (MAX(ABS(XP(J)-XP(I)),ABS(YP(J)-YP(I))).LT.TTT.OR.
     & MIN(SQRT(DIR1_1**2+DIR1_2**2),SQRT(DIR2_1**2+DIR2_2**2)).LT.TTT) 
     &  THEN
CC        PRINT*,'HEHE'
        RETURN
      ENDIF
      FAC1 = TAILLE/SQRT(DIR1_1**2+DIR1_2**2)
      FAC2 = TAILLE/SQRT(DIR2_1**2+DIR2_2**2)
      CAR1_1 = DIR1_1*FAC1
      CAR1_2 = DIR1_2*FAC1
      CAR2_1 = DIR2_1*FAC2
      CAR2_2 = DIR2_2*FAC2
      TIC1_1 = CAR1_1*.45
      TIC1_2 = CAR1_2*.45
      TIC2_1 = CAR2_1*.45
      TIC2_2 = CAR2_2*.45
      XMIN = REAL(ECH(1))
      XMAX = XMIN
      IF (NN.GT.1) THEN
        DO N=2,NN
          XMIN = MIN(XMIN,REAL(ECH(N)))
          XMAX = MAX(XMAX,REAL(ECH(N)))
        ENDDO
      ENDIF
      XCPREC = 1.E30
      YCPREC = 1.E30
      DO N=1,NN
        X1 = PROP(N)*(X(J)-X(I))+X(I)
        Y1 = PROP(N)*(Y(J)-Y(I))+Y(I)
        Z1 = PROP(N)*(Z(J)-Z(I))+Z(I)
        CALL PROJEC(X1,Y1,Z1,SENS,XX,YY,IPERSP,XPUP,DIST)
        TIC1 = PROP(N)*(TIC2_1-TIC1_1)+TIC1_1
        TIC2 = PROP(N)*(TIC2_2-TIC1_2)+TIC1_2
        IF (ITIC.EQ.0) THEN
          CALL GSMOVE(XX-TIC1,YY-TIC2)
          CALL GSLINE(XX+TIC1,YY+TIC2)
        ENDIF
        IF (INUMNUM.EQ.0) THEN
          CALL TRAD(ECH(N),CC,NC,XMIN,XMAX)
          CAR1 = PROP(N)*(CAR2_1-CAR1_1)+CAR1_1
          CAR2 = PROP(N)*(CAR2_2-CAR1_2)+CAR1_2
          X1 = XX-CAR1
          X2 = XX+CAR1
          Y1 = YY-CAR2
          Y2 = YY+CAR2
          D1 = (X1-XMID)**2 + (Y1-YMID)**2
          D2 = (X2-XMID)**2 + (Y2-YMID)**2
          IF (D1.GE.D2) THEN
            XC = X1
            YC = Y1
          ELSE
            XC = X2
            YC = Y2
          ENDIF
          USNOR = 1./SQRT(CAR1**2+CAR2**2)
          ANG = DEGRE((XC-XX)*USNOR,(YC-YY)*USNOR)
          IF (ABS(ANG).LE.22.5) THEN
            YC = YC - YSHIFT
          ELSEIF(ABS(ANG).LE.67.5) THEN
            IF (ANG.LT.0.) YC = YC - 2.*YSHIFT 
          ELSEIF(ABS(ANG).LE.112.5) THEN
            XC = XC - REAL(NC)*XSHIFT
            IF (ANG.LT.0.) YC = YC - 2.*YSHIFT 
          ELSEIF(ABS(ANG).LE.157.5) THEN
            XC = XC - REAL(2*NC)*XSHIFT
            IF (ANG.LT.0.) YC = YC - 2.*YSHIFT 
          ELSE
            XC = XC - REAL(2*NC)*XSHIFT
            YC = YC - YSHIFT
          ENDIF
Cfj          print*,abs(xc-xcprec),real(nc+1)*abs(tic1)
Cfj     &         ,abs(yc-ycprec),3.*abs(tic2),' $$ '//cc(1:nc)
          if (abs(xc-xcprec).gt.real(nc+1)*abs(tic1)
     &         .or.abs(yc-ycprec).gt.3.*abs(tic2)) then
            CALL GSCHAR(XC,YC,NC,CC)
c
c provisoire (log) (12/2000)
            IF (ILOG.NE.0) CALL GSCHAR(XC-4.*XSHIFT,YC-YSHIFT,2,'10')
            xcprec = xc
            ycprec = yc
          endif
        ENDIF
      ENDDO
      END
