5 * Revision 1.1.1.1 1999/05/18 15:55:03 fca
8 * Revision 1.1.1.1 1995/10/24 10:20:27 cernlib
12 #include "geant321/pilot.h"
13 *CMZ : 3.21/02 29/03/94 15.41.27 by S.Giani
15 SUBROUTINE GDRWSC(ISHAPE,PAR)
17 C. ******************************************************************
19 C. * Draw the shape number ISHAPE, of parameters PAR, *
22 C. * ==>Called by : GDRAW *
23 C. * Author : P.Zanarini ********* *
24 C. * Modification log. *
25 C. * 31-May-88 A.C.McPherson - Introduce cut tube shape. *
27 C. ******************************************************************
29 #include "geant321/gcbank.inc"
30 #include "geant321/gcdraw.inc"
31 #include "geant321/gconsp.inc"
32 #include "geant321/gcshno.inc"
33 PARAMETER ( NLPC = 40 )
35 * The constant NLPC defined in the parameter statement
36 * is the number of line elements to form a complete
37 * circle in the surface definitions for a cut tube.
39 DIMENSION PAR(100),P(3,8)
40 DIMENSION XMAX1(2,42),XMIN1(2,42),XMAX2(2,42),XMIN2(2,42)
42 C. ------------------------------------------------------------------
44 IF (ISHAPE.NE.1) GO TO 200
55 200 IF (ISHAPE.NE.2) GO TO 300
66 300 IF (ISHAPE.NE.3) GO TO 400
77 400 IF (ISHAPE.NE.4) GO TO 500
94 500 IF (ISHAPE.NE.5) GO TO 600
106 600 IF (ISHAPE.NE.6) GO TO 700
120 700 IF (ISHAPE.NE.7) GO TO 800
132 800 IF (ISHAPE.NE.8) GO TO 900
146 900 IF (ISHAPE.NE.9) GO TO 910
154 910 IF (ISHAPE.NE.10) GO TO 911
177 911 IF (ISHAPE.NE.11) GO TO 912
185 DPHI=(PHIMAX-PHIMIN)/NDIV
187 C Z(1)=PAR(5) - RMIN(1)=PAR(6) - RMAX(1)=PAR(7) - Z(2)=PAR(8) - ...
191 912 IF (ISHAPE.NE.12) GO TO 950
199 C Z(1)=PAR(4) - RMIN(1)=PAR(5) - RMAX(1)=PAR(6) - Z(2)=PAR(7) - ...
205 IF (ISHAPE.NE.13) GO TO 951
216 IF (ISHAPE.NE.14) GO TO 955
223 TANTHS = (TAN(PAR(4)*DEGRAD))**2
226 RMIN2 = SQRT(RMIN12 + Z2*Z2*TANTHS)
227 RMAX2 = SQRT(RMAX12 + Z2*Z2*TANTHS)
232 IF(ISHAPE.NE.28) GO TO 980
234 C General twisted trapezoid.
239 P(1,IL)=PAR(I0)+PAR(I0+2)*P(3,IL)
240 P(2,IL)=PAR(I0+1)+PAR(I0+3)*P(3,IL)
242 P(1,IL+4)=PAR(I0)+PAR(I0+2)*P(3,IL+4)
243 P(2,IL+4)=PAR(I0+1)+PAR(I0+3)*P(3,IL+4)
249 IF( ISHAPE .EQ. NSCTUB ) THEN
251 DPHIS = PAR(5)-PAR(4)
252 IF( DPHIS .LE. 0.0 ) DPHIS=DPHIS+TWOPI
253 NL = DPHIS*NLPC/360.0
256 IF( PAR(4) .EQ. 0.0 .AND. PAR(5) .EQ. 360.0 ) THEN
271 C Rectilinear shapes: BOX,TRD1,TRD2
280 C Calculate the 8 vertex for rectilinear shapes
309 C Store all the surfaces (back,front,top,bottom,right,left)
311 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
312 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
313 CALL GDSSUR(P(1,5),P(1,1),P(1,2),P(1,6))
314 CALL GDSSUR(P(1,8),P(1,4),P(1,3),P(1,7))
315 CALL GDSSUR(P(1,5),P(1,1),P(1,4),P(1,8))
316 CALL GDSSUR(P(1,6),P(1,2),P(1,3),P(1,7))
318 C Intersect cut-plane with all the surfaces of the shape
319 C and draw the resulting lines
329 C Calculate the 8 vertex
331 P(1,1)=-DZ*TX+TTH1*H1+TL1
334 P(1,2)=-DZ*TX+TTH1*H1-TL1
337 P(1,3)=-DZ*TX-TTH1*H1-BL1
340 P(1,4)=-DZ*TX-TTH1*H1+BL1
343 P(1,5)=+DZ*TX+TTH2*H2+TL2
346 P(1,6)=+DZ*TX+TTH2*H2-TL2
349 P(1,7)=+DZ*TX-TTH2*H2-BL2
352 P(1,8)=+DZ*TX-TTH2*H2+BL2
356 C Store all the surfaces (back,front,top,bottom,right,left)
358 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
359 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
360 CALL GDSSUR(P(1,5),P(1,1),P(1,2),P(1,6))
361 CALL GDSSUR(P(1,8),P(1,4),P(1,3),P(1,7))
362 CALL GDSSUR(P(1,5),P(1,1),P(1,4),P(1,8))
363 CALL GDSSUR(P(1,6),P(1,2),P(1,3),P(1,7))
365 C Intersect cut-plane with all the surfaces of the shape
366 C and draw the resulting lines
374 C Cylindric shapes: TUBE,CONE
381 P(1,2)=RMAX1*GCOS(I+1)
382 P(2,2)=RMAX1*GSIN(I+1)
384 P(1,3)=RMIN1*GCOS(I+1)
385 P(2,3)=RMIN1*GSIN(I+1)
393 P(1,6)=RMAX2*GCOS(I+1)
394 P(2,6)=RMAX2*GSIN(I+1)
396 P(1,7)=RMIN2*GCOS(I+1)
397 P(2,7)=RMIN2*GSIN(I+1)
403 C Store top,bottom,back,front surfaces
405 CALL GDSSUR(P(1,1),P(1,2),P(1,6),P(1,5))
406 CALL GDSSUR(P(1,4),P(1,3),P(1,7),P(1,8))
407 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
408 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
412 C Intersect cut-plane with all the surfaces of the shape
413 C and draw the resulting lines
421 C Segmented cylindric shapes: TUBS,CONS
423 CALL GDSARC(RMAX1,PHIMIN,PHIMAX,XMAX1,NP)
424 CALL GDSARC(RMIN1,PHIMIN,PHIMAX,XMIN1,NP)
425 CALL GDSARC(RMAX2,PHIMIN,PHIMAX,XMAX2,NP)
426 CALL GDSARC(RMIN2,PHIMIN,PHIMAX,XMIN2,NP)
457 C Store top,bottom,back,front surfaces
459 CALL GDSSUR(P(1,1),P(1,2),P(1,6),P(1,5))
460 CALL GDSSUR(P(1,4),P(1,3),P(1,7),P(1,8))
461 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
462 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
464 C Store right surface
466 IF (I.NE.1) GO TO 2505
467 CALL GDSSUR(P(1,5),P(1,1),P(1,4),P(1,8))
472 IF (I.NE.NP1) GO TO 2510
473 CALL GDSSUR(P(1,6),P(1,2),P(1,3),P(1,7))
477 C Intersect cut-plane with all the surfaces of the shape
478 C and draw the resulting lines
486 C Normal view or X-view or Y-view or Z-view for SPHE
488 C Cut not implemented
496 FACT=1./COS(DEGRAD*DPHI/2.)
498 PAR(6+(IZ-1)*3)=PAR(6+(IZ-1)*3)*FACT
499 PAR(7+(IZ-1)*3)=PAR(7+(IZ-1)*3)*FACT
515 PHI0=PHIMIN+(IDIV-1)*DPHI
545 C Store top and bottom surfaces
547 CALL GDSSUR(P(1,1),P(1,2),P(1,6),P(1,5))
548 CALL GDSSUR(P(1,4),P(1,3),P(1,7),P(1,8))
552 IF (IZ.NE.1) GO TO 4010
553 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
555 C Store front surface
558 IF (IZ.NE.NZ1) GO TO 4020
559 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
561 C Store right surface
564 IF (ABS(PHIMAX-PHIMIN).EQ.360.) GO TO 4045
565 IF (IDIV.NE.1) GO TO 4030
566 CALL GDSSUR(P(1,5),P(1,1),P(1,4),P(1,8))
571 IF (IDIV.NE.NDIV) GO TO 4045
572 CALL GDSSUR(P(1,6),P(1,2),P(1,3),P(1,7))
576 C Intersect cut-plane with the surfaces of one Z section
577 C and draw the resulting lines
600 CALL GDSARC(R1,PHIMIN,PHIMAX,XMAX1,NP)
601 CALL GDSARC(R0,PHIMIN,PHIMAX,XMIN1,NP)
602 CALL GDSARC(RR1,PHIMIN,PHIMAX,XMAX2,NP)
603 CALL GDSARC(RR0,PHIMIN,PHIMAX,XMIN2,NP)
611 P(1,2)=XMAX1(1,IDIV+1)
612 P(2,2)=XMAX1(2,IDIV+1)
614 P(1,3)=XMIN1(1,IDIV+1)
615 P(2,3)=XMIN1(2,IDIV+1)
623 P(1,6)=XMAX2(1,IDIV+1)
624 P(2,6)=XMAX2(2,IDIV+1)
626 P(1,7)=XMIN2(1,IDIV+1)
627 P(2,7)=XMIN2(2,IDIV+1)
633 C Store top and bottom surfaces
635 CALL GDSSUR(P(1,1),P(1,2),P(1,6),P(1,5))
636 CALL GDSSUR(P(1,4),P(1,3),P(1,7),P(1,8))
640 IF (IZ.NE.1) GO TO 5001
641 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
643 C Store front surface
646 IF (IZ.NE.NZ1) GO TO 5002
647 CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
649 C Store right surface
652 IF (ABS(PHIMAX-PHIMIN).EQ.360.) GO TO 5005
653 IF (IDIV.NE.1) GO TO 5003
654 CALL GDSSUR(P(1,5),P(1,1),P(1,4),P(1,8))
659 IF (IDIV.NE.NDIV) GO TO 5005
660 CALL GDSSUR(P(1,6),P(1,2),P(1,3),P(1,7))
664 C Intersect cut-plane with the surfaces of one Z section
665 C and draw the resulting lines
677 CPHIS = COS( PHIS*DEGRAD )
678 SPHIS = SIN( PHIS*DEGRAD )
679 P( 1, 1) = PAR(2)*CPHIS
680 P( 2, 1) = PAR(2)*SPHIS
681 P( 3, 1) = -( PAR( 6)*P( 1, 1) +PAR( 7)*P( 2, 1) )/PAR( 8)
683 P( 1, 4) = PAR(1)*CPHIS
684 P( 2, 4) = PAR(1)*SPHIS
685 P( 3, 4) = -( PAR( 6)*P( 1, 4) +PAR( 7)*P( 2, 4) )/PAR( 8)
687 P( 1, 5) = PAR(2)*CPHIS
688 P( 2, 5) = PAR(2)*SPHIS
689 P( 3, 5) = -( PAR( 9)*P( 1, 5) +PAR( 10)*P( 2, 5) )/PAR( 11)
691 P( 1, 8) = PAR(1)*CPHIS
692 P( 2, 8) = PAR(1)*SPHIS
693 P( 3, 8) = -( PAR( 9)*P( 1, 8) +PAR( 10)*P( 2, 8) )/PAR( 11)
698 CPHIS = COS( PHIS*DEGRAD )
699 SPHIS = SIN( PHIS*DEGRAD )
700 P( 1, 2) = PAR(2)*CPHIS
701 P( 2, 2) = PAR(2)*SPHIS
702 P( 3, 2) = -( PAR( 6)*P( 1, 1) +PAR( 7)*P( 2, 1) )/PAR( 8)
704 P( 1, 3) = PAR(1)*CPHIS
705 P( 2, 3) = PAR(1)*SPHIS
706 P( 3, 3) = -( PAR( 6)*P( 1, 4) +PAR( 7)*P( 2, 4) )/PAR( 8)
708 P( 1, 6) = PAR(2)*CPHIS
709 P( 2, 6) = PAR(2)*SPHIS
710 P( 3, 6) = -( PAR( 9)*P( 1, 5) +PAR( 10)*P( 2, 5) )/PAR( 11)
712 P( 1, 7) = PAR(1)*CPHIS
713 P( 2, 7) = PAR(1)*SPHIS
714 P( 3, 7) = -( PAR( 9)*P( 1, 8) +PAR( 10)*P( 2, 8) )/PAR( 11)
717 CALL GDSSUR( P(1,1), P(1,2), P(1,6), P(1,5) )
718 CALL GDSSUR( P(1,4), P(1,3), P(1,7), P(1,8) )
719 CALL GDSSUR( P(1,1), P(1,2), P(1,3), P(1,4) )
720 CALL GDSSUR( P(1,5), P(1,6), P(1,7), P(1,8) )
722 IF( ISEG .EQ. 1 ) THEN
724 CALL GDSSUR( P(1,5), P(1,1), P(1,4), P(1,8) )
725 ELSEIF ( I .EQ. NL ) THEN
726 CALL GDSSUR( P(1,6), P(1,2), P(1,3), P(1,7) )
773 C Store top,back,front surfaces
775 CALL GDSSUR(P(1,1),P(1,2),P(1,5),P(1,4))
776 CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,3))
777 CALL GDSSUR(P(1,4),P(1,5),P(1,6),P(1,6))
781 C Intersect cut-plane with all the surfaces of the shape
782 C and draw the resulting lines
791 C Another cylindrical shape: HYPE
794 DZ = Z2 / NZSTEP * 2.
795 RMA1 = SQRT(RMAX12 + Z2*Z2*TANTHS)
796 RMI1 = SQRT(RMIN12 + Z2*Z2*TANTHS)
798 DO 7400 J = 1, NZSTEP
800 Z2T = (ZZ2**2) * TANTHS
801 RMA2 = SQRT(RMAX12 + Z2T)
802 RMI2 = SQRT(RMIN12 + Z2T)
808 P(1,2)=RMA1*GCOS(I+1)
809 P(2,2)=RMA1*GSIN(I+1)
811 P(1,3)=RMI1*GCOS(I+1)
812 P(2,3)=RMI1*GSIN(I+1)
820 P(1,6)=RMA2*GCOS(I+1)
821 P(2,6)=RMA2*GSIN(I+1)
823 P(1,7)=RMI2*GCOS(I+1)
824 P(2,7)=RMI2*GSIN(I+1)
830 C Store top and bottom surfaces only
832 CALL GDSSUR(P(1,1),P(1,2),P(1,6),P(1,5))
833 CALL GDSSUR(P(1,4),P(1,3),P(1,7),P(1,8))
834 C CALL GDSSUR(P(1,1),P(1,2),P(1,3),P(1,4))
835 C CALL GDSSUR(P(1,5),P(1,6),P(1,7),P(1,8))
845 C Intersect cut-plane with all the surfaces of the shape
846 C and draw the resulting lines