%N grfa %F $MIR/src/grfa.f
%D Fill area (polygon)
%B
      SUBROUTINE GRFA (N,PX,PY)
      INTEGER N
      REAL PX(*), PY(*)

 GRPCKG: FILL AREA: fill a polygon with solid color.  The polygon
 is defined by the (x,y) world coordinates of its N vertices.  If
 this is not a function supported by the device, shading is
 accomplished by drawing horizontal lines spaced by 1 pixel.  By
 selecting color index 0, the interior of the polygon can be erased
 on devices which permit it.  The polygon need not be convex, but if
 it is re-entrant (i.e., edges intersect other than at the vertices),
 it may not be obvious which regions are "inside" the polygon.  The
 following rule is applied: for a given point, create a straight line
 starting at the point and going to infinity. If the number of
 intersections between the straight line and the polygon is odd, the
 point is within the polygon; otherwise it is outside. If the
 straight line passes a polygon vertex tangentially, the
 intersection  count is not affected. The only attribute which applies
 to FILL AREA is color index: line-width and line-style are ignored.
 There is a limitation on the complexity of the polygon: GFA will
 fail if any horizontal line intersects more than 32 edges of the
 polygon.

 Arguments:

 N (input, integer): the number of vertices of the polygon (at least
       3).
 PX, PY (input, real arrays, dimension at least N): world coordinates
       of the N vertices of the polygon.
