5 * Revision 1.1.1.1 1995/10/24 10:20:53 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.30 by S.Giani
12 SUBROUTINE GNPARA (X, PAR, IACT, SNEXT, SNXT, SAFE)
14 C. ******************************************************************
16 C. * COMPUTE DISTANCE UP TO INTERSECTION WITH 'PARA' VOLUME, *
17 C. * FROM INSIDE POINT X(1-3) ALONG DIRECTION X(4-6) *
19 C. * PAR (input) : volume parameters *
20 C. * IACT (input) : action flag *
21 C. * = 0 Compute SAFE only *
22 C. * = 1 Compute SAFE, and SNXT only if SNEXT .GT.new SAFE *
23 C. * = 2 Compute both SAFE and SNXT *
24 C. * = 3 Compute SNXT only *
25 C. * SNEXT (input) : see IACT = 1 *
26 C. * SNXT (output) : distance to volume boundary *
27 C. * SAFE (output) : shortest distance to any boundary *
29 C. * ==>Called by : GNEXT, GTNEXT *
30 C. * Author A.McPherson ********* *
32 C. ******************************************************************
34 #include "geant321/gconsp.inc"
35 DIMENSION X(6), PAR(6)
37 C. ---------------------------------------------------
46 CTY=1.0/SQRT(1.0+PAR(6)**2)
48 XT=X(1)-PAR(5)*X(3)-PAR(4)*YT
51 CTX=1.0/SQRT(1.0+PAR(4)**2+PAR(5)**2)
56 C -------------------------------------------------
57 C | Compute safety-distance 'SAFE' (McPherson) |
58 C -------------------------------------------------
61 SAFE=MIN(DN11*CTX,-DN12*CTX,DN21*CTY,-DN22*CTY,DN31,-DN32)
63 IF (IACT .EQ. 0) GO TO 999
65 IF (SNEXT .LT. SAFE) GO TO 999
69 C ------------------------------------------------
70 C | Compute vector-distance 'SNXT' (McPherson) |
71 C ------------------------------------------------
78 IF(X(6).NE.0.0) SN3=DN31/X(6)
79 IF(SN3.LT.0.0) SN3=DN32/X(6)
82 IF(DY.NE.0.0) SN2=DN21/DY
83 IF(SN2.LT.0.0) SN2=DN22/DY
85 DX=X(4)-PAR(5)*X(6)-PAR(4)*DY
86 IF(DX.NE.0.0) SN1=DN11/DX
87 IF(SN1.LT.0.0) SN1=DN12/DX