Convert spherical (r,alpha,beta) to Cartesian (x,y,z).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | r |
magnitude |
||
real(kind=wp), | intent(in) | :: | alpha |
right ascension [rad] |
||
real(kind=wp), | intent(in) | :: | beta |
declination [rad] |
[x,y,z] vector
pure function spherical_to_cartesian(r,alpha,beta) result(rvec) implicit none real(wp),intent(in) :: r !! magnitude real(wp),intent(in) :: alpha !! right ascension [rad] real(wp),intent(in) :: beta !! declination [rad] real(wp),dimension(3) :: rvec !! [x,y,z] vector rvec(1) = r * cos(alpha) * cos(beta) rvec(2) = r * sin(alpha) * cos(beta) rvec(3) = r * sin(beta) end function spherical_to_cartesian