# PGPLOT Module: PGPOLY -- draw a polygon, using fill-area attributes

SUBROUTINE PGPOLY (N, XPTS, YPTS)

INTEGER N

REAL XPTS(*), YPTS(*)

Fill-area primitive routine: shade the interior of a closed

polygon in the current window. The action of this routine depends

on the setting of the Fill-Area Style attribute (see PGSFS).

The polygon is clipped at the edge of the

window. The pen position is changed to (XPTS(1),YPTS(1)) in world

coordinates (if N > 1). If the polygon is not convex, a point is

assumed to lie inside the polygon if a straight line drawn to

infinity intersects and odd number of the polygon's edges.

**Arguments**

N (input) : number of points defining the polygon; the

line consists of N straight-line segments,

joining points 1 to 2, 2 to 3,... N-1 to N, N to 1.

N should be greater than 2 (if it is 2 or less,

nothing will be drawn).

XPTS (input) : world x-coordinates of the vertices.

YPTS (input) : world y-coordinates of the vertices.

Note: the dimension of arrays XPTS and YPTS must be

greater than or equal to N.