MGH_POLYFILLA
Name
MGH_POLYFILLA
Description
Given a 2-D polygon and a rectangular grid, this function returns
an array indicating which of the pixels in the grid is inside the
polygon.
See also MGH_POLYFILLG.
Calling Sequence
result = mgh_polyfilla(x, y, sx, sy[, FRACTION=fraction][, PACK=1|0])
Positional Parameters
x,y (input, numeric vectors)
Vectors defining the polygon in the "subscript space" of the
grid.
sx,sy (input, integer scalars)
Dimensions of the pixel grid on which the polygon is
superposed.
Keyword Parameters
FRACTION (output, floating array)
For each pixel index, return the fractional area of that
pixel contained inside the polygon, between 0 and 1. This
parameter has the same shape as the return values
COUNT (output, sclar integer)
The number of pixels inside the polygon.
PACK (input, switch)
Determines the form in which the results are returned. If PACK
is 0, the return value is a byte array of dimensions [sx,sy]
specifying whether each pixel is inside the polygon. If PACK is
1 (default), the return value is an integer array containing
the 1-D indices of all pixels
Return Value
The function determines which pixels are (at least partially)
inside the polygon. The form of the return value depends on the
setting of the PACK switch.
###########################################################################
Copyright (c) 2001-2015 NIWA:
http://www.niwa.co.nz/
Licensed under the MIT open source license:
http://www.opensource.org/licenses/mit-license.php
###########################################################################
Modification History
Mark Hadfield, 2001-10:
Written, based on JD Smith's POLYFILLAA function.
Mark Hadfield, 2015-02:
Source code format updated.