Function: ellipsefill Purpose: Set a mask for each point in a box that is inside a polygon Category: MATH File: ellipsefill.c Author: M.G.R. Vogelaar Description: Set a mask of points in a box that are contained by an ellipse Use: void ellipsefill( int *mask, int blo[0], int blo[1], int bhi[0], int bhi[1], float *ellpar ); The equation (for a non-rotated ellipse) is: (X-Xc)^2/major^2 + (Y-Yc))^2/minor^2 = 1 An ellipse is defined by a number of parameters set by 'ellpar': Xc = ellpar[0]; Yc = ellpar[1]; major = ellpar[2]; minor = ellpar[3]; Pa = ellpar[4]; These are the centre of the ellipse in grids, the length in grids of the semi major axis, the length in grids of the semi minor axis, Pa is position angle of ellipse wrt. pos x-axis in degrees. Note that the terms major and minor are just names and could easily be replaced by e.g. a and b. The ellipse therefore is mathematical, not astronomical. A mask is an integer array with as many elements as contained in the box given by blo and bhi (usually from the BOX= keyword). This mask represents the data in a subset in a box with limits blo and bhi. Initially it should be set to zero for each element in the mask. The function loops over all grid positions in the box and if such a grid is inside the ellipse, then the corresponding position in the mask is flagged (i.e. one is added to the array element). Remarks: Updates: Jul 26, 2004: VOG, Document created.