5 * Revision 1.1.1.1 1995/10/24 10:20:19 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.25 by S.Giani
12 SUBROUTINE GD3D3D(XIN,NPOINT,XOUT,INV)
14 C. ******************************************************************
16 C. * Routine to transform the 3D points given by array XIN *
17 C. * into the 3D points in XOUT: *
18 C. * if INV=0 the Z-axis for XOUT is the line of sight for XIN*
19 C. * if INV=1 the Z-axis for XIN is the line of sight for XOUT*
21 C. * ==>Called by : <USER>, GDCUT *
22 C. * Author : P.Zanarini ********* *
24 C. ******************************************************************
26 #include "geant321/gcvolu.inc"
27 #include "geant321/gcdraw.inc"
28 DIMENSION XC(3),XOUT(3,1),VL(3),VM(3),VN(3),XIN(3,1)
31 C. ------------------------------------------------------------------
33 IF(NPOINT.EQ.0)GO TO 999
35 IF(NPOINT.LT.0)N=-NPOINT
36 IF(NGVIEW.NE.0) GO TO 40
38 C First call compute the rotation matrix
40 PH = ABS(MOD(GPHI,360.))
41 THET = ABS(MOD(GTHETA,360.))
42 IF(THET.LE.180.)GO TO 10
46 10 ST = SIN(THET * 0.017453)
47 CT = COS(THET * 0.017453)
48 SP = SIN(PH * 0.017453)
49 CP = COS(PH * 0.017453)
57 IF(ABS(VN(2)).GT.0.99999)GO TO 20
63 C Define new lambda axis
73 C Special case when observer line of sight is along mu:
74 C in this case one chooses arbitrarily the vertical axis of
75 C plane of projection as the lambda axis and the horizontal
90 C Begin of a normal call (i.e. with NGVIEW=1)
94 C Loop over the points
98 C NPOINT < 0 : XIN is in general reference system
101 XC(1)=VL(1)*XIN(1,I)+VM(1)*XIN(2,I)+VN(1)*XIN(3,I)
102 XC(2)=VL(2)*XIN(1,I)+VM(2)*XIN(2,I)+VN(2)*XIN(3,I)
103 XC(3)=VL(3)*XIN(1,I)+VM(3)*XIN(2,I)+VN(3)*XIN(3,I)
105 XC(1)=XIN(1,I)*VL(1)+XIN(2,I)*VL(2)+XIN(3,I)*VL(3)
106 XC(2)=XIN(1,I)*VM(1)+XIN(2,I)*VM(2)+XIN(3,I)*VM(3)
107 XC(3)=XIN(1,I)*VN(1)+XIN(2,I)*VN(2)+XIN(3,I)*VN(3)
116 C NPOINT > 0 : XIN is in volume reference system
118 CALL GINROT(XIN(1,I),GRMAT(1,NLEVEL),XC)
120 XOUT(J,I)=XC(J)+GTRAN(J,NLEVEL)