mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 12:48:40 -05:00
f283ca5c62
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3839 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
26 lines
506 B
Fortran
26 lines
506 B
Fortran
subroutine toxyz(alpha,delta,r,vec)
|
|
|
|
implicit real*8 (a-h,o-z)
|
|
real*8 vec(3)
|
|
|
|
vec(1)=r*cos(delta)*cos(alpha)
|
|
vec(2)=r*cos(delta)*sin(alpha)
|
|
vec(3)=r*sin(delta)
|
|
|
|
return
|
|
end subroutine toxyz
|
|
|
|
subroutine fromxyz(vec,alpha,delta,r)
|
|
|
|
implicit real*8 (a-h,o-z)
|
|
real*8 vec(3)
|
|
data twopi/6.283185307d0/
|
|
|
|
r=sqrt(vec(1)**2 + vec(2)**2 + vec(3)**2)
|
|
alpha=atan2(vec(2),vec(1))
|
|
if(alpha.lt.0.d0) alpha=alpha+twopi
|
|
delta=asin(vec(3)/r)
|
|
|
|
return
|
|
end subroutine fromxyz
|