This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / geocad / gtrset.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:47  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.32  by  S.Giani
11 *-- Author :
12       SUBROUTINE  GTRSET(PAR)
13 C-
14 C-   Created  26-JUL-1991   Nils Joar Hoimyr
15 C-   Modified 21.02.1992  Jouko Vuoskoski
16 C-
17 C-  Calculates the coordinates of the corner points of a GEANT GTRA  shape
18 C-  from the shape parameters.   The end faces are generated by drawing
19 C-  connected polylines between the corner points at each Z-end of the shape.
20 C-  A ruled solid is then defined between the 2 faces, and written out in SET.
21 C----------------------------------------------------------------------
22 C
23 #include "geant321/gcsetf.inc"
24  
25 C
26       DIMENSION PAR(50)
27       REAL P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z
28       REAL P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z
29 C
30 C----------------------------------------------------------------------
31 C
32 C  GTRA as TRAP except that the faces are rotated aroud the Z-axis
33 C
34 C             TRAP
35 C
36  
37       DZ=PAR(1)
38       TX= (PAR(2)*3.14159265359)/180.
39       TY= (PAR(3)*3.14159265359)/180.
40       TWIST=(PAR(4)*3.14159265359)/180.
41       H1=PAR(5)
42       BL1=PAR(6)
43       TL1=PAR(7)
44       H2=PAR(9)
45       BL2=PAR(10)
46       TL2=PAR(11)
47 C       Parameter conv for faces..
48 C       FACE parameters:
49 C       FACE 1:
50       P1X= -BL1-DZ*SIN(TX)
51       P1Y= -H1-DZ*SIN(TY)
52       P1Z= -DZ
53 C
54       P2X= BL1-DZ*SIN(TX)
55       P2Y= -H1-DZ*SIN(TY)
56       P2Z= -DZ
57 C
58       P3X= TL1-DZ*SIN(TX)
59       P3Y= H1-DZ*SIN(TY)
60       P3Z= -DZ
61 C
62       P4X= -TL1-DZ*SIN(TX)
63       P4Y= H1-DZ*SIN(TY)
64       P4Z= -DZ
65 C       Next FACE:
66       P5X= -BL2+DZ*SIN(TX)
67       P5Y= -H2+DZ*SIN(TY)
68       P5Z= DZ
69 C
70       P6X= BL2+DZ*SIN(TX)
71       P6Y= -H2+DZ*SIN(TY)
72       P6Z= DZ
73 C
74       P7X= TL2+DZ*SIN(TX)
75       P7Y= H2+DZ*SIN(TY)
76       P7Z= DZ
77 C
78       P8X= -TL2+DZ*SIN(TX)
79       P8Y= H2+DZ*SIN(TY)
80       P8Z= DZ
81 C       DESCRIBED BY 2 FACES represented by polylines
82 C       connected by the 4 corners of the shape.
83 C *WRITE SET@103,F1#3,3,2,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z
84 C      Geometric Transformation
85 C*WRITE SET @302,N1..#301,R1,R2,R3,R4,R5,R6,R7,R8,R9
86 C *WRITE SET@113,
87 C *WRITE SET@103,F2#3,3,2,P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z
88 C
89 C *WRITE SET @100,N#145,!F1,!F2,
90 C-------------------------------------------------------------------
91 C
92       WRITE(BLKSTR,10000)N1,P1X,P1Y,P1Z,P2X,P2Y,P2Z, P3X,P3Y,P3Z,P4X,
93      +P4Y,P4Z
94       CALL GJWRIT
95 C     Rotation of face:
96 C
97 C      Rotation around the Z-axis.  Coeffisients of rotation:
98       R1= COS(-TWIST)
99       R2= -SIN(-TWIST)
100       R3= 0.0
101       R4= SIN(-TWIST)
102       R5= COS(-TWIST)
103       R6= 0.0
104       R7= 0.0
105       R8= 0.0
106       R9= 1.0
107 C
108 C Twist applied, results in constructed faces.
109       N1=N1+1
110       WRITE(BLKSTR,10100)N1,R1,R2,R3,R4,R5,R6,R7,R8,R9
111       CALL GJWRIT
112       N1=N1+1
113       WRITE(BLKSTR,10200)N1,N1-2,N1-1
114       CALL GJWRIT
115 C     Second face:
116       N1=N1+1
117       WRITE(BLKSTR,10000)N1,P5X,P5Y,P5Z,P6X,P6Y,P6Z, P7X,P7Y,P7Z,P8X,
118      +P8Y,P8Z
119       CALL GJWRIT
120 C     Rotation of faces:
121 C
122 C      Rotation around the Z-axis.  Coeffisients of rotation:
123       R1= COS(TWIST)
124       R2= -SIN(TWIST)
125       R3= 0.0
126       R4= SIN(TWIST)
127       R5= COS(TWIST)
128       R6= 0.0
129       R7= 0.0
130       R8= 0.0
131       R9= 1.0
132 C
133 C Twist applied, results in constructed faces.
134       N1=N1+1
135       WRITE(BLKSTR,10100)N1,R1,R2,R3,R4,R5,R6,R7,R8,R9
136       CALL GJWRIT
137       N1=N1+1
138       WRITE(BLKSTR,10200)N1,N1-2,N1-1
139       CALL GJWRIT
140       N1=N1+1
141       WRITE(BLKSTR,10300)N1,N1-4,N1-1
142       CALL GJWRIT
143 C
144 10000   FORMAT('@103,',I10,',:5,2#3,3,2,',G14.7,',',G14.7,','
145      +  ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7,','
146      +  ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7)
147 10100   FORMAT('@302,',I10,'#301,',G14.7,',',G14.7,',',G14.7
148      +  ,',',G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7)
149 10200   FORMAT('@113,',I10,',:5,2#101,!',I10,',!',I10)
150 10300   FORMAT('@100,',I10,',:5,2#145,!',I10,',!',I10)
151 C
152 C
153    10 RETURN
154       END