Reference Guide > P Routines > POLYFILLV Function
  

POLYFILLV Function
Returns a vector containing the subscripts of the array elements contained inside a specified polygon.
Usage
result = POLYFILLV(x, y, sx, sy[, run_length])
Input Parameters
x — A vector containing the x subscripts of the vertices that define the polygon.
y — A vector containing the y subscripts of the vertices that define the polygon.
sx — The number of columns in the array surrounding the polygon.
sy — The number of rows in the array surrounding the polygon.
run_length — (optional) If present and nonzero, returns a vector of run lengths, rather than subscripts. Each element with an even subscript result contains the length of the run, and the following element contains the starting index of the run.
For large polygons, using run_length can save considerable space.
Returned Value
result — A vector containing the subscripts of the array elements contained inside a polygon defined by x and y.
Keywords
None.
Discussion
POLYFILLV is useful in defining, analyzing, and displaying regions of interest within a two-dimensional array.
The x and y parameters are vectors containing 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
The polygon is defined by connecting each point with its successor and the last point with the first.
Example
This example determines 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-by-512 array called data.
data = DIST(512, 512)
; Define triangle's coordinates.
x = [100, 200, 300]
y = [100, 300, 100]
; Get the subscripts of the elements in the polygon.
p = data(POLYFILLV(x, y, 512, 512))
 
; Use the STDEV function to obtain the mean and
; standard deviation of the selected elements.
std = STDEV(p, mean)
See Also
POLY_AREA

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.