-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrotate_haxis.f
52 lines (41 loc) · 1.39 KB
/
rotate_haxis.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
subroutine rotate_haxis(rotang,xp0,yp0)
C+______________________________________________________________________________
!
! ROTATE_HAXIS- Calculate new trajectory coordinates in reference frame rotated
! about horizontal axis by angle ROTANG relative to central ray.
!
! *** Right-handed TRANSPORT coordinates are assumed! ***
!
! ROTANG is an angle about the negative Y-axis.
! For the SOS BM01 entrance, it is a negative number.
!
! Input trajectory is: X = XS + ALPHA*(Z-ZS)
! Y = YS + BETA *(Z-ZS)
! Z = ZS is current point.
!
! Output traject is: XP = XP0 + ALPHA_P*ZP
! YP = YP0 + BETA_P *ZP
! ZP = 0 gives intersection of track with rotated plane.
!
! ROTANG (R*4): Rotation angle in degrees.
!
! D. Potterveld, 15-Mar-1993.
C-______________________________________________________________________________
implicit none
include 'track.inc'
real*8 rotang,xp0,yp0,xi
real*8 alpha,beta,alpha_p,beta_p,sin_th,cos_th,tan_th
save
C ============================= Executable Code ================================
1 tan_th = tan(rotang)
sin_th = sin(rotang)
cos_th = cos(rotang)
alpha = dxdzs
beta = dydzs
alpha_p= (alpha + tan_th)/(1. - alpha*tan_th)
beta_p = beta/(cos_th - alpha*sin_th)
xi = xp0
xp0 = xi*(cos_th + alpha_p*sin_th)
yp0 = yp0 + xi*beta_p*sin_th
return
end