5 * Revision 1.1.1.1 1995/10/24 10:20:50 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.29 by S.Giani
12 SUBROUTINE GINGTR(X,P,IYES)
14 C. ******************************************************************
17 C. * SUBROUTINE GINGTR(X,P,IYES) *
18 C. * Routine performes GINME type function to determine *
19 C. * whether the point X is in the GTRA shape with parameters *
20 C. * P. IYES is returned 1 if it is 0 if not. *
21 C. * A.C.McPherson 22nd April 1985 *
23 C. * Called by : GINME *
25 C ******************************************************************
27 DIMENSION X(3),P(30),XPT(4),YPT(4)
29 C. ----------------------------------------
31 C First the range in Z is checked.
34 IF(ABS(X(3)).GT.P(1)) GO TO 30
36 C Next the four corners at the z of the input point (X(3))
41 XPT(I) = P(I0)+P(I0+2)*X(3)
42 YPT(I) = P(I0+1)+P(I0+3)*X(3)
45 C Then the cross product between the vector from that
46 C corner to the input point and the vector from that corner
47 C to the next corner is computed and its sign is
48 C interrogated. Since the quadralateral is convex, if any
49 C one of these signs is wrong, the point is outside the
50 C shape. This task is performed as follows:
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