Generates a grid of points in a polygon (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).
Option
PRINT = string token |
What to print (summary ); default summ |
---|
Parameters
YPOLYGON = variates |
Vertical coordinates of each polygon; no default – this parameter must be set |
---|---|
XPOLYGON = variates |
Horizontal coordinates of each polygon; no default – this parameter must be set |
NPOINTS = scalars |
How many points to generate |
YSTEP = scalars |
Spacings to use between columns of the grid |
XSTEP = scalars |
Spacings to use between rows of the grid |
YGRID = variates |
Variates to receive the vertical coordinates of the points in the grid |
XGRID = variates |
Variates to receive the horizontal coordinates of the points in the grid |
Description
This procedure generates a grid of points in a polygon specified by the parameters XPOLYGON
and YPOLYGON
. The size of the grid may be specified in either of two ways. The first method is to specify the total number of points to be generated using the parameter NPOINTS
. The value supplied for NPOINTS
must be a positive integer. This method will produce a square grid, the number of rows and columns being approximately equal to SQRT(NPOINTS)
. The second method is to specify the required spacing between rows and columns of the grid using the parameters XSTEP
and YSTEP
. The values supplied for XSTEP
and YSTEP
should be on the scale of the coordinates of the polygon. If the parameter NPOINTS
is set then any values specified for XSTEP
and YSTEP
will be ignored. The coordinates of the points which are generated may be saved using the parameters XGRID
and YGRID
.
Printed output is controlled by the PRINT
option. The default setting of summary
prints the horizontal and vertical coordinates of the points in the grid under the headings XGRID
and YGRID
.
Option: PRINT
.
Parameters: YPOLYGON
, XPOLYGON
, NPOINTS
, YSTEP
, XSTEP
, YGRID
, XGRID
.
Method
A procedure PTCHECKXY
is called to check that XPOLYGON
and YPOLYGON
have identical restrictions. PTBOX
is used to calculate the bounding box for the polygon specified by XPOLYGON
and YPOLYGON
. A grid of points spanning the bounding box is created according to the settings of NPOINTS
(appropriately scaled to produce the equivalent density of points on the bounding box), XSTEP
and YSTEP
. Any points which fall outside the specified polygon are then removed using PTSINPOLYGON
.
Action with RESTRICT
If XPOLYGON
and YPOLYGON
are restricted, only the subset of values specified by the restriction will be included in the calculations.
See also
Procedure: DPOLYGON
.
Commands for: Spatial statistics.
Example
CAPTION 'PTGRID example'; STYLE=meta VARIATE xpoly; VALUES=!(0,1,1,0) & ypoly; VALUES=!(0,0,1,1) PTGRID YPOLYGON=ypoly; XPOLYGON=xpoly; NPOINTS=16