``` NAME:
cgetrng
PURPOSE: (one line)
How to integrate over a circle.
DESCRIPTION:
This procedure is called to determine how to iterate when integrating
over a circle.  The circle's center is at (xc,yc), and its radius is r.
For pixels with x-coordinate x, those in the intervals [y0,y1) and [y2,y3)
are on or near the circle.  Those in the interval [y1,y2) are definitely
inside; all others are definitely outside.
Of course, the routine can be called to determine an interval for fixed
y by calling it as cgetrng,yc,xc,r,y,x0,x1,x2,x3.
The appropriate way to integrate over a circle is therefore as follows:
cgetrng,xc,yc,r,Round(xc),y0,y1,y2,y3
for (y = y0; y <= y3-1; y=y+1) {
cgetrng, yc, xc, r, y, x0, x1, x2, x3;
for (x = x0; x <= x1-1; x=x+1) sum = sum + value(x,y)*pixwt(xc,yc,r,x,y);
for (x = x1; x <= x2-1; x=x+1) sum = sum + value(x,y);
for (x = x2; x <= x3-1; x=x+1) sum = sum + value(x,y)*pixwt(xc,yc,r,x,y);
}
CATEGORY:
CCD data processing
CALLING SEQUENCE:
cgetrng, xc, yc, r, x, y0, y1, y2, y3
INPUTS:
xc, yc : Center of the circle.
r      : Radius of the circle.
x      : X coordinate for the intervals to be determined.
OPTIONAL INPUT PARAMETERS:
None.
KEYWORD PARAMETERS:
None.
OUTPUTS:
y0, y1, y2, y3 : The endpoints of the three intervals of interest.
COMMON BLOCKS:
None.
SIDE EFFECTS:
RESTRICTIONS:
None.
PROCEDURE:
Determine three intervals along the x input coordinate:  The
intervals [y0,y1), [y1,y2), and [y2,y3).
MODIFICATION HISTORY:
Ported by Doug Loucks, Lowell Observatory, 1992 Sep, from the
routine cgetrng in pixwt.c, by Marc Buie.