COSMOS v7.655
COSMOSv7655
(AirShowerMC)
kxplsph.f
Go to the documentation of this file.
1
subroutine
kxplsph
(x0, y0, z0, l, m, n, r, el, icon)
2
implicit none
3
real*8
x0, y0, z0
! input. the line passes this point
4
real*8
l, m, n
! input. direc cos. of the line
5
real*8
r
! input. radius of the sphere
6
real*8
el
! output. el>=0 distance to the
7
! sphere from x0,y0,z0
8
integer
icon
! output. icon =0. x-point exists
9
! x0,.. is inside
10
! icon = 1 x-point exists
11
! x0.. is outside
12
! =-1. no x-point
13
14
real*8
rsqr, r0l, d
15
integer
icon1, icon2
16
17
rsqr = x0**2 + y0**2 + z0**2 -r**2
18
if
(rsqr .le. 0.)
then
19
! inside
20
icon2 = 0
21
else
22
icon2 = 1
23
endif
24
r0l = x0*l + y0*m + z0*n
25
d = r0l**2 - rsqr
26
if
(d .ge. 0.)
then
27
d = sqrt(d)
28
el = -r0l - d
29
if
(el .ge. 0.)
then
30
icon1 = 0
31
else
32
el = -r0l + d
33
if
(el .ge. 0.)
then
34
icon1 = 0
35
else
36
icon1 = 1
37
endif
38
endif
39
else
40
icon1 = 1
41
endif
42
!
43
if
(icon2 .eq. 0)
then
44
icon = 0
45
elseif
(icon1 .eq. 0)
then
46
icon = 1
47
else
48
icon = -1
49
endif
50
end
51
kxplsph
subroutine kxplsph(x0, y0, z0, l, m, n, r, el, icon)
Definition:
kxplsph.f:2
UserHook
Vflux
kxplsph.f
Generated by
1.8.13