* * $Id$ * * $Log$ * Revision 1.1.1.1 1995/10/24 10:20:47 cernlib * Geant * * #include "geant321/pilot.h" *CMZ : 3.21/02 29/03/94 15.41.32 by S.Giani *-- Author : SUBROUTINE GTRSET(PAR) C- C- Created 26-JUL-1991 Nils Joar Hoimyr C- Modified 21.02.1992 Jouko Vuoskoski C- C- Calculates the coordinates of the corner points of a GEANT GTRA shape C- from the shape parameters. The end faces are generated by drawing C- connected polylines between the corner points at each Z-end of the shape. C- A ruled solid is then defined between the 2 faces, and written out in SET. C---------------------------------------------------------------------- C #include "geant321/gcsetf.inc" C DIMENSION PAR(50) REAL P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z REAL P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z C C---------------------------------------------------------------------- C C GTRA as TRAP except that the faces are rotated aroud the Z-axis C C TRAP C DZ=PAR(1) TX= (PAR(2)*3.14159265359)/180. TY= (PAR(3)*3.14159265359)/180. TWIST=(PAR(4)*3.14159265359)/180. H1=PAR(5) BL1=PAR(6) TL1=PAR(7) H2=PAR(9) BL2=PAR(10) TL2=PAR(11) C Parameter conv for faces.. C FACE parameters: C FACE 1: P1X= -BL1-DZ*SIN(TX) P1Y= -H1-DZ*SIN(TY) P1Z= -DZ C P2X= BL1-DZ*SIN(TX) P2Y= -H1-DZ*SIN(TY) P2Z= -DZ C P3X= TL1-DZ*SIN(TX) P3Y= H1-DZ*SIN(TY) P3Z= -DZ C P4X= -TL1-DZ*SIN(TX) P4Y= H1-DZ*SIN(TY) P4Z= -DZ C Next FACE: P5X= -BL2+DZ*SIN(TX) P5Y= -H2+DZ*SIN(TY) P5Z= DZ C P6X= BL2+DZ*SIN(TX) P6Y= -H2+DZ*SIN(TY) P6Z= DZ C P7X= TL2+DZ*SIN(TX) P7Y= H2+DZ*SIN(TY) P7Z= DZ C P8X= -TL2+DZ*SIN(TX) P8Y= H2+DZ*SIN(TY) P8Z= DZ C DESCRIBED BY 2 FACES represented by polylines C connected by the 4 corners of the shape. C *WRITE SET@103,F1#3,3,2,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z C Geometric Transformation C*WRITE SET @302,N1..#301,R1,R2,R3,R4,R5,R6,R7,R8,R9 C *WRITE SET@113, C *WRITE SET@103,F2#3,3,2,P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z C C *WRITE SET @100,N#145,!F1,!F2, C------------------------------------------------------------------- C WRITE(BLKSTR,10000)N1,P1X,P1Y,P1Z,P2X,P2Y,P2Z, P3X,P3Y,P3Z,P4X, +P4Y,P4Z CALL GJWRIT C Rotation of face: C C Rotation around the Z-axis. Coeffisients of rotation: R1= COS(-TWIST) R2= -SIN(-TWIST) R3= 0.0 R4= SIN(-TWIST) R5= COS(-TWIST) R6= 0.0 R7= 0.0 R8= 0.0 R9= 1.0 C C Twist applied, results in constructed faces. N1=N1+1 WRITE(BLKSTR,10100)N1,R1,R2,R3,R4,R5,R6,R7,R8,R9 CALL GJWRIT N1=N1+1 WRITE(BLKSTR,10200)N1,N1-2,N1-1 CALL GJWRIT C Second face: N1=N1+1 WRITE(BLKSTR,10000)N1,P5X,P5Y,P5Z,P6X,P6Y,P6Z, P7X,P7Y,P7Z,P8X, +P8Y,P8Z CALL GJWRIT C Rotation of faces: C C Rotation around the Z-axis. Coeffisients of rotation: R1= COS(TWIST) R2= -SIN(TWIST) R3= 0.0 R4= SIN(TWIST) R5= COS(TWIST) R6= 0.0 R7= 0.0 R8= 0.0 R9= 1.0 C C Twist applied, results in constructed faces. N1=N1+1 WRITE(BLKSTR,10100)N1,R1,R2,R3,R4,R5,R6,R7,R8,R9 CALL GJWRIT N1=N1+1 WRITE(BLKSTR,10200)N1,N1-2,N1-1 CALL GJWRIT N1=N1+1 WRITE(BLKSTR,10300)N1,N1-4,N1-1 CALL GJWRIT C 10000 FORMAT('@103,',I10,',:5,2#3,3,2,',G14.7,',',G14.7,',' + ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7,',' + ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7) 10100 FORMAT('@302,',I10,'#301,',G14.7,',',G14.7,',',G14.7 + ,',',G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7) 10200 FORMAT('@113,',I10,',:5,2#101,!',I10,',!',I10) 10300 FORMAT('@100,',I10,',:5,2#145,!',I10,',!',I10) C C 10 RETURN END