]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GEANT321/ggeom/gingtr.F
Cleaned up some more in AliL3MemHandler, by removing the AliL3Transform in
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gingtr.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1995/10/24 10:20:50 cernlib
6* Geant
7*
8*
9#include "geant321/pilot.h"
10*CMZ : 3.21/02 29/03/94 15.41.29 by S.Giani
11*-- Author :
12 SUBROUTINE GINGTR(X,P,IYES)
13C.
14C. ******************************************************************
15C. * *
16C. * *
17C. * SUBROUTINE GINGTR(X,P,IYES) *
18C. * Routine performes GINME type function to determine *
19C. * whether the point X is in the GTRA shape with parameters *
20C. * P. IYES is returned 1 if it is 0 if not. *
21C. * A.C.McPherson 22nd April 1985 *
22C. * *
23C. * Called by : GINME *
24C. * *
25C ******************************************************************
26C.
27 DIMENSION X(3),P(30),XPT(4),YPT(4)
28C.
29C. ----------------------------------------
30C.
31C First the range in Z is checked.
32C
33 IYES=0
34 IF(ABS(X(3)).GT.P(1)) GO TO 30
35C
36C Next the four corners at the z of the input point (X(3))
37C are computed as:
38C
39 DO 10 I=1,4
40 I0=I*4+11
41 XPT(I) = P(I0)+P(I0+2)*X(3)
42 YPT(I) = P(I0+1)+P(I0+3)*X(3)
43 10 CONTINUE
44C
45C Then the cross product between the vector from that
46C corner to the input point and the vector from that corner
47C to the next corner is computed and its sign is
48C interrogated. Since the quadralateral is convex, if any
49C one of these signs is wrong, the point is outside the
50C shape. This task is performed as follows:
51C
52 DO 20 I=1,4
53 J = I+1
54 IF(J.EQ.5) J=1
55 CROSS = (X(1)-XPT(I))*(YPT(J)-YPT(I)) -
56 + (X(2)-YPT(I))*(XPT(J)-XPT(I))
57 IF(CROSS.GT.0.0) GO TO 30
58 20 CONTINUE
59 IYES = 1
60 30 CONTINUE
61 RETURN
62 END