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