function new_pol_to_cart,rtp
;
; transform polare coordinats to cartesian coordinats.
;
; done by Klaus Galsgaard
;
; CORRECTED VERSION!!! (Bo, May 19, 1994)
; rtp(*,0): redshift
; rtp(*,1): alpha
; rtp(*,2): delta
on_error,2
; Bo Milvang-Jensen, May 20, 1994.
if n_params() eq (0) then begin
print
print, 'Function new_pol_to_cart'
print
print, 'Usage:'
print, 'new_pol_to_cart, rtp'
print
print, 'Description:'
print, 'This function converts from (redshift, alpha, delta) to'
print, '(x, y, z).'
print
print, 'rtp: array, with'
print, ' rtp(*,0) = redshit'
print, ' rtp(*,1) = alpha'
print, ' rtp(*,2) = delta'
print
rc = -1 ; ?!
return, rc
end
s=size(rtp)
rc=fltarr(s(1),3,/nozero)
rc(*,0)=rtp(*,0)*sin(!pi/2.-rtp(*,2))*cos(rtp(*,1))
rc(*,1)=rtp(*,0)*sin(!pi/2.-rtp(*,2))*sin(rtp(*,1))
rc(*,2)=rtp(*,0)*cos(!pi/2.-rtp(*,2))
return,rc
end