The POLYFILLV function returns a vector containing the subscripts of the array elements contained inside a polygon defined by vectors.
The X and Y parameters are vectors that contain the subscripts of the vertices that define the polygon in the coordinate system of the two-dimensional Sx by Sy array. The Sx and Sy parameters define the number of columns and rows in the array enclosing the polygon. At least three points must be specified, and all points should lie within the limits: 0 £ Xi < Sx and 0 £ Yi < Sy for all i.
As with the POLYFILL procedure, the polygon is defined by connecting each point with its successor and the last point with the first. This function is useful for defining, analyzing, and displaying regions of interest within a two-dimensional array.
The scan line coordinate system defined by Rogers in Procedural Elements for Computer Graphics, McGraw-Hill, 1985, page 71, is used. In this system, the scan lines are considered to pass through the center of each row of pixels. Pixels are activated if the center of the pixel is to the right of the intersection of the scan line and the polygon edge within the interval.
Result = POLYFILLV( X, Y, Sx, Sy [, Run_Length] )
Returns a vector containing the one-dimensional subscripts of the array elements contained inside a polygon defined by vectors X and Y. If no points are contained within the polygon, a -1 is returned and an informational message is printed.
A vector containing the X subscripts of the vertices that define the polygon.
A vector containing the Y subscripts of the vertices that define the polygon.
The number of columns in the array surrounding the polygon.
The number of rows in the array surrounding the polygon.
Set this optional parameter to a nonzero value to make POLYFILLV return a vector of run lengths, rather than subscripts. For large polygons, a considerable savings in space results. When run-length encoded, each element with an even subscript result contains the length of the run, and the following element contains the starting index of the run.
To determine the mean and standard deviation of the elements within a triangular region defined by the vertices at pixel coordinates (100, 100), (200, 300), and (300, 100), inside a 512 x 512 array called DATA, enter the commands:
; Get the subscripts of the elements inside the triangle: P = DATA[POLYFILLV([100,200,300], [100,300,100], 512, 512)] ; Use the STDEV function to obtain the mean and standard deviation ; of the selected elements: STD = STDEV(P,MEAN)