5 * Revision 1.1.1.1 1995/10/24 10:20:22 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.26 by S.Giani
14 C. ******************************************************************
16 C. * Draw the 4 lines obtained by the intersection *
17 C. * of the cut plane (at point DCUT along axis ICUT) and *
18 C. * the NSURF surfaces stored in vector SURF. *
19 C. * DCUT, ICUT, NSURF, SURF are in common block GCDRAW. *
21 C. * ==>Called by : GDRWSC, GDSSUR *
22 C. * Author : P.Zanarini ********* *
24 C. ******************************************************************
26 #include "geant321/gcbank.inc"
27 #include "geant321/gcdraw.inc"
29 EQUIVALENCE (WS(1),SURF(1))
30 DIMENSION P(3,2),U(2),V(2),XI(2),YI(2),ZI(2),PL(3),PR(3)
31 EQUIVALENCE (PL(1),XL),(PL(2),YL),(PL(3),ZL)
32 EQUIVALENCE (PR(1),XR),(PR(2),YR),(PR(3),ZR)
37 C. ------------------------------------------------------------------
39 C Let be L(XL,YL,ZL) and R(XR,YR,ZR) the extreme points of a line,
40 C I(XI,YI,ZI) the intersection point between the line and
41 C the cut-plane (for example Z=C, i.e. the plane normal to Z axis).
46 C XI = XL + (ZI-ZL) ------- = XL + (C-ZL) -------
51 C YI = YL + (XI-XL) ------- = YL + (C-XL) -------
58 C Then we have two cases:
61 C i.e. the cut-plane intersects the line at I(XI,YI,ZI) :
62 C a line is drawn between that point and next one
65 C i.e. the line is parallel to (or into) the cut-plane :
69 IF (NSURF.EQ.0) GO TO 80
78 IF (ICUT.LT.1.OR.ICUT.GT.3) GO TO 80
99 C Transform PL and PR to have Z-axis = line of sight CTHETA,
106 CALL GD3D3D(PL,-1,PL,0)
107 CALL GD3D3D(PR,-1,PR,0)
114 C Is the line parallel to the cut-plane ?
116 IF ((PL(ICUT).GE.PR(ICUT)-EPS).AND.(PL(ICUT).LE.PR(ICUT)+
121 AMX=MAX(PL(ICUT),PR(ICUT))
122 AMN=MIN(PL(ICUT),PR(ICUT))
123 IF ((DCUT.LT.AMN).OR.(DCUT.GT.AMX)) GO TO 40
127 IF (ICUT.NE.3) GO TO 10
128 XI(J)=XL+(DCUT-ZL)*(XR-XL)/(ZR-ZL)
129 YI(J)=YL+(DCUT-ZL)*(YR-YL)/(ZR-ZL)
133 10 IF (ICUT.NE.1) GO TO 20
135 YI(J)=YL+(DCUT-XL)*(YR-YL)/(XR-XL)
136 ZI(J)=ZL+(DCUT-XL)*(ZR-ZL)/(XR-XL)
140 XI(J)=XL+(DCUT-YL)*(XR-XL)/(YR-YL)
142 ZI(J)=ZL+(DCUT-YL)*(ZR-ZL)/(YR-YL)
144 30 IF (J.EQ.2) GO TO 50
166 CALL GD3D3D(P(1,1),-2,P(1,1),1)
173 C Points are now in general reference system
175 CALL GDFR3D(P,-2,U,V)
177 CM Short circuit in case of GMR
179 IF ( IGMR .EQ. 0 ) CALL GDRAWV(U,V,2)