]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/ggeom/gvsign.F
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gvsign.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:57  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.31  by  S.Giani
11 *-- Author :
12 *
13       INTEGER FUNCTION GVSIGN (XYZ, C0, C, NC)
14 ************************************************************************
15 *                                                                      *
16 * Calculate the sign of the given point in relation          YB 870424 *
17 * to the  surface                                            VP 880312 *
18 *                                                                      *
19 * Input :       XYZ -  point to be tested                              *
20 *               C0  -  first coefficient of surface                    *
21 *               C   -  coefficients of surface in the standart form    *
22 *                      ,the first one is taken from C1                 *
23 *               NC  -  number of coefficients (4,7, 10)                *
24 *                                                                      *
25 * Output :     -1, 0, +1  depending on side                            *
26 *                                                                      *
27 ************************************************************************
28       COMMON /SLATE/ SLATE (40)
29       INTEGER        ISLATE(40)
30       EQUIVALENCE    (SLATE,ISLATE)
31       REAL           XYZ(3), C(0:9)
32       EQUIVALENCE    (TMP,SLATE(1))
33 *-----------------------------------------------------------------------
34  
35 #if defined(CERNLIB_GVCONT)
36       NSIGN = NSIGN + 1
37 #endif
38 *
39       GO TO (10013,10002,10013,10004,10013
40      +,      10013,10007,10013,10013,10010),NC
41 10013 CALL ZFATAM('GVSIGN. WRONG length')
42 *
43 *               special simple case
44 10002 IAX   = C(1)
45       IF (IAX.LE.3)             THEN
46 *               X,Y,Z boundary
47         TMP = C0 + XYZ(IAX)
48       ELSE
49 *               Rxy boundary
50         TMP = -C0**2 + XYZ(1)**2 + XYZ(2)**2
51       ENDIF
52       GO TO 10090
53 *               plane boundary
54 10004 TMP   = C0+C(1)*XYZ(1)+C(2)*XYZ(2)+C(3)*XYZ(3)
55       GO TO 10090
56  
57 *               2nd order boundary, short case
58 10007 TMP   = C0
59      ++XYZ(1)*(C(1)+C(4)*XYZ(1))
60      ++XYZ(2)*(C(2)+C(5)*XYZ(2))
61      ++XYZ(3)*(C(3)+C(6)*XYZ(3))
62       GO TO 10090
63 *               2nd order boundary, general case
64 10010 TMP   = C0
65      ++XYZ(1)*(C(1)+C(4)*XYZ(1)+C(7)*XYZ(2))
66      ++XYZ(2)*(C(2)+C(5)*XYZ(2)+C(8)*XYZ(3))
67      ++XYZ(3)*(C(3)+C(6)*XYZ(3)+C(9)*XYZ(1))
68 *
69 10090 IS    = -1
70       IF (TMP.GE.0.)            IS = 1
71 *
72   999 GVSIGN = IS
73       RETURN
74       END