;------------------------------------------------------------------------------ ;+ ; NAME: ; lambert_lb2xy ; ; PURPOSE: ; Transform from galactic (l,b) coordinates to (x,y) coordinates from origin. ; Latitude runs clockwise from X-axis for NGP, counterclockwise for SGP. ; ; CALLING SEQUENCE: ; lambert_lb2xy, lcoord, bcoord, nsgp, scale, xcoord, ycoord ; ; INPUTS: ; lcoord: Galactic longitude(s) in degrees. ; bcoord: Galactic latitude(s) in degrees. ; nsgp: +1 for NGP projection, -1 for SGP; ; scalar of vector same size as LCOORD. ; scale: Radius of b=0 to b=90 degrees in pixels, usually 512. ; ; OUTPUTS: ; xcoord: X position in pixels from the center. ; ycoord: Y position in pixels from the center. ; ; PROCEDURES CALLED: ; ; REVISION HISTORY: ; Written by D. Schlegel, 30 May 1996, Durham ;- ;------------------------------------------------------------------------------ pro lambert_lb2xy, lcoord, bcoord, nsgp, scale, xcoord, ycoord ; Need six parameters if N_params() LT 6 then begin print, 'Syntax - lambert_lb2xy, lcoord, bcoord, nsgp, scale,' print, ' xcoord, ycoord' return endif ; Convert coordinates from degrees to radians dradeg = 180.d0 / !dpi ll = double( lcoord / dradeg ) bb = double( bcoord / dradeg ) rho = sqrt(1. - nsgp * sin(bb)) xcoord = rho * cos(ll) * scale ycoord = -nsgp * rho * sin(ll) * scale return end ;------------------------------------------------------------------------------