1      SUBROUTINE TRAIT(V1,V2,V3,N1,N2,N3,X1,X2,X3,Y1,Y2,Y3,T1,T2,T3
2     &                ,SENS,IOPT)
3      DIMENSION T1(*),T2(*),T3(*)
4      DIMENSION X(4),Y(4)
5      INCLUDE 'com_ombreiso.f'
6C
7      IF (IOPT.GE.0) CALL GSCOL(IOPT)
8      IF (N1.EQ.N2) THEN
9        II = 0
10        DO I=N1,N3-1
11          II = II+1
12          X(3) = T1(II)*(X2-X3) + X3
13          Y(3) = T1(II)*(Y2-Y3) + Y3
14          X(4) = T2(II)*(X1-X3) + X3
15          Y(4) = T2(II)*(Y1-Y3) + Y3
16          IF (IOPT.LT.0) CALL GSCOL(ISOMBRE+1+I)
17          IF (SENS*V3.GE.SENS*V2) THEN
18            CALL GSMOVE(X(4),Y(4))
19            CALL GSLINE(X(3),Y(3))
20          ELSE
21            CALL GSMOVE(X(3),Y(3))
22            CALL GSLINE(X(4),Y(4))
23          ENDIF
24          CALL MARVAL(I+1,X(3),X(4),Y(3),Y(4))
25        ENDDO
26      ELSE
27        X(3) = T3(1)*(X1-X2) + X2
28        Y(3) = T3(1)*(Y1-Y2) + Y2
29        X(4) = T2(1)*(X1-X3) + X3
30        Y(4) = T2(1)*(Y1-Y3) + Y3
31        II = 1
32        IF ((N1+2).LE.N2) THEN
33          DO I=N1+1,N2-1
34            II = II+1
35            X(1) = X(4)
36            Y(1) = Y(4)
37            X(2) = X(3)
38            Y(2) = Y(3)
39            X(3) = T3(II)*(X1-X2) + X2
40            Y(3) = T3(II)*(Y1-Y2) + Y2
41            X(4) = T2(II)*(X1-X3) + X3
42            Y(4) = T2(II)*(Y1-Y3) + Y3
43            IF (IOPT.LT.0) CALL GSCOL(ISOMBRE+I)
44            IF (SENS*V2.GE.SENS*V1) THEN
45              CALL GSMOVE(X(1),Y(1))
46              CALL GSLINE(X(2),Y(2))
47            ELSE
48              CALL GSMOVE(X(2),Y(2))
49              CALL GSLINE(X(1),Y(1))
50            ENDIF
51            CALL MARVAL(I,X(1),X(2),Y(1),Y(2))
52          ENDDO
53        ENDIF
54        X(1) = X(4)
55        Y(1) = Y(4)
56        X(2) = X(3)
57        Y(2) = Y(3)
58        IF (IOPT.LT.0) CALL GSCOL(ISOMBRE+N2)
59        IF (SENS*V2.GE.SENS*V1) THEN
60          CALL GSMOVE(X(1),Y(1))
61          CALL GSLINE(X(2),Y(2))
62        ELSE
63          CALL GSMOVE(X(2),Y(2))
64          CALL GSLINE(X(1),Y(1))
65        ENDIF
66        CALL MARVAL(N2,X(1),X(2),Y(1),Y(2))
67        IF (N2.EQ.N3) THEN
68          X(4) = X3
69          Y(4) = Y3
70        ELSE
71          X(3) = T1(1)*(X2-X3) + X3
72          Y(3) = T1(1)*(Y2-Y3) + Y3
73          II = II+1
74          X(4) = T2(II)*(X1-X3) + X3
75          Y(4) = T2(II)*(Y1-Y3) + Y3
76          II2 = 1
77          IF ((N2+2).LE.N3) THEN
78            DO I=N2+1,N3-1
79              II = II+1
80              II2 = II2+1
81              X(1) = X(4)
82              Y(1) = Y(4)
83              X(2) = X(3)
84              Y(2) = Y(3)
85              X(3) = T1(II2)*(X2-X3) + X3
86              Y(3) = T1(II2)*(Y2-Y3) + Y3
87              X(4) = T2(II)*(X1-X3) + X3
88              Y(4) = T2(II)*(Y1-Y3) + Y3
89              IF (IOPT.LT.0) CALL GSCOL(ISOMBRE+I)
90              IF (SENS*V3.GE.SENS*V2) THEN
91                CALL GSMOVE(X(1),Y(1))
92                CALL GSLINE(X(2),Y(2))
93              ELSE
94                CALL GSMOVE(X(2),Y(2))
95                CALL GSLINE(X(1),Y(1))
96              ENDIF
97              CALL MARVAL(I,X(1),X(2),Y(1),Y(2))
98            ENDDO
99          ENDIF
100          IF (IOPT.LT.0) CALL GSCOL(ISOMBRE+N3)
101          IF (SENS*V3.GE.SENS*V2) THEN
102            CALL GSMOVE(X(4),Y(4))
103            CALL GSLINE(X(3),Y(3))
104          ELSE
105            CALL GSMOVE(X(3),Y(3))
106            CALL GSLINE(X(4),Y(4))
107          ENDIF
108          CALL MARVAL(N3,X(3),X(4),Y(3),Y(4))
109        ENDIF
110      ENDIF
111      END
112C---------------------------------------------------------------------
113      SUBROUTINE MARVAL(I,X1,X2,Y1,Y2)
114      INCLUDE 'com_val.f'
115      IF (X1.EQ.X2.AND.Y1.EQ.Y2) RETURN
116      X = .5*(X1+X2)
117      Y = .5*(Y1+Y2)
118      IF (X.GT.XMMIN.AND.X.LT.XMMAX.AND.Y.GT.YMMIN.AND.Y.LT.YMMAX) THEN
119        VALMAR(1,I-1) = X
120        VALMAR(2,I-1) = Y
121      ENDIF
122      END
123