; ; NAME fms_cyl ; ; FUNCTION Determine pixel coordinates of a cylindrical wedge vertices ; using keyboard input. ; ; HISTORY Andrew L. Stanger HAO/NCAR 11 February 1999 ; 18 Feb 1999: Write min/max radii & angles to log file. ;- PRO fms_cyl, rmin, rmax, angmin, angmax, $ xdim, ydim, xcen, ycen, pixrs, roll, $ aoinum, logfile, pvfile, xv, yv, nver, polypix rxmin = xcen rxmax = xdim - 1 axmin = xcen axmax = xdim - 1 rymin = ycen rymax = ydim - 1 aymin = ycen aymax = ydim - 1 angle = 0.0 radius = 0.0 ; print, 'Using the keyboard to define a "curved" wedge-shaped area.' ; print, 'Enter the minimum & maximum radii : ' ; read, rmin, rmax ; print, 'Enter the minimum & maximum angles : ' ; read, angmin, angmax ; print, 'rmin, rmax: ', rmin, rmax IF (angmin GT angmax) THEN angmax = angmax + 360.0 ; print, 'angmin, angmax: ', angmin, angmax nang = 72 ; nang = 12 ; nang = FIX ((angmax - angmin) + 0.5) ; One vertex for every angular degree. nver = (nang + 1) * 2 + 1 print, 'nang: ', nang print, 'nver: ', nver anginc = (angmax - angmin) / nang print, 'anginc: ', anginc ; print, 'nver: ', nver xv = fltarr (nver) yv = fltarr (nver) ;--- Vertex of first point. iv = 0 ierr = rcoord (rmin, angmin, xx, yy, 1, roll, xcen, ycen, pixrs) xv [iv] = xx yv [iv] = yy iv = iv + 1 ;--- Vertices of outer curve. FOR i = 0, nang DO $ BEGIN angle = angmin + anginc * i ierr=rcoord (rmax, angle, xx, yy, 1, roll, xcen, ycen, pixrs) xv [iv] = xx yv [iv] = yy ; print, 'iv, rmax, angle, xv, yv: ', iv, rmax, angle, xv [iv], yv [iv] iv = iv + 1 END ;--- Vertices of inner curve. FOR i = 0, nang DO $ BEGIN angle = angmax - anginc * i ierr=rcoord (rmin, angle, xx, yy, 1, roll, xcen, ycen, pixrs) xv [iv] = xx yv [iv] = yy ; print, 'iv, rmin, angle, xv, yv: ', iv, rmin, angle, xv [iv], yv [iv] iv = iv + 1 END ;--- Write Region information into log file. OPENW, lulog, logfile, /GET_LUN PRINTF, lulog, 'Keyboard-Defined Curved Wedge Region: ', $ STRING (aoinum, FORMAT='(i3)') PRINTF, lulog, STRING (rmin, FORMAT='(F7.2)'), ' --> ', $ STRING (rmax, FORMAT='(F7.2)'), ' Rsun ', $ STRING (angmin, FORMAT='(F7.2)'), ' --> ', $ STRING (angmax, FORMAT='(F7.2)'), ' degrees' PRINTF, lulog, 'polygon vertices file: ', pvfile PRINTF, lulog, '' CLOSE, lulog FREE_LUN, lulog ; print, 'i: ', i ; FOR i = 0, nver-1 DO print, 'i, xv, yv: ', i, xv [i], yv [i] ;--- Write polygon vertices to a disk file. store_poly, pvfile, xv, yv, nver ;--- Determine coordinates of all pixels within polygon area. polypix = POLYFILLV (xv, yv, xdim, ydim) ;--- pixels in polygon. size_poly = SIZE (polypix) ; print, 'size (polypix): ', size_poly ;--- Draw polygon perimeter. PLOTS, xv, yv, color=253, /DEVICE PLOTS, xv [0], yv [0], color=253, /DEVICE, /CONTINUE END