Closes open polygons (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson)
|What to print (
||Vertical coordinates of each polygon; no default – this parameter must be set|
||Horizontal coordinates of each polygon; no default – this parameter must be set|
||Vertical coordinates of the closed polygons|
||Horizontal coordinates of the closed polygons|
A polygonal region of two-dimensional space is represented in Genstat by the coordinates of a sequence of points which define the boundary of the polygon with the last point implicitly connected to the first point. If the first and last pairs of coordinates are the same then the polygon is said to be closed, otherwise it is open. Sometimes it is necessary to work with a closed polygon, for example, when drawing a polygon onto a graphics device as a series of line segments. This procedure takes as input a set of coordinates which define a polygon. The parameters
OLDYPOLYGON specify variates containing the coordinates. The output of the procedure is a closed polygon, which is identical to the input polygon if it is already closed and otherwise consists of the input polygon with the first pair of coordinates repeated at the end. The coordinates of the closed polygon may be saved using the parameters
Printed output is controlled by the
PTCHECKXY is called to check that
OLDYPOLYGON have identical restrictions. It then checks whether the first and last pairs of coordinates are the same. If they are, the
DUPLICATE directive is used to copy
NEWYPOLYGON. If they are different,
NEWYPOLYGON are declared as variates with one more value than their old counterparts, and the
EQUATE directive is used to copy the values from
NEWYPOLYGON (so that the first element of each old variate is repeated at the end of the corresponding new one).
OLDYPOLYGON are restricted, only the subset of values specified by the restriction will be included in the calculations.
Commands for: Spatial statistics.
CAPTION 'PTCLOSEPOLYGON example'; STYLE=meta VARIATE xpoly; VALUES=!(0,1,1,0) & ypoly; VALUES=!(0,0,1,1) PTCLOSEPOLYGON OLDYPOLYGON=ypoly; OLDXPOLYGON=xpoly