Previous: filpa2 Up: ../plot79_f.html Next: filpi


FILPA3

       SUBROUTINE  FILPA3 (XARRAY,INCX, YARRAY,INCY, ZARRAY,INCZ, N,
      X                   PDIST, NPDIST, THETA, BOX, ALPHA)
 C$    (Fill Polygon Absolute 3-D)
 C$    Fill an arbitrary polygon with a user-defined pattern.  The
 C$    pattern is  defined  by a  series  of parallel  lines  with
 C$    variable spacing  and  fixed  slope.   Two  calls  to  this
 C$    routine  can  be  used   to  obtain  cross-hatching.    The
 C$    arguments are:
 C$
 C$    XARRAY(*).........Array  of   absolute  X  coordinates   of
 C$                      polygon vertices.
 C$    INCX..............Displacement  between successive X values
 C$                      in XARRAY(*) (normally 1).
 C$    YARRAY(*).........Array   of  absolute  Y   coordinates  of
 C$                      polygon vertices.
 C$    INCY..............Displacement  between successive Y values
 C$                      in YARRAY(*) (normally 1).
 C$    ZARRAY(*).........Array  of   absolute Z   coordinates   of
 C$                      polygon vertices.
 C$    INCZ..............Displacement  between successive Z values
 C$                      in ZARRAY(*) (normally 1).
 C$    N.................Number  of  data   points   defining  the
 C$                      polygon.  The  polygon  is  automatically
 C$                      closed by connecting point N to point  1.
 C$                      A move will be done to the point 1 before
 C$                      beginning to draw the polygon.
 C$    PDIST(*)..........Array of  world coordinate  perpendicular
 C$                      distances between successive lines of the
 C$                      pattern.   The   sign  of   PDIST(K)   is
 C$                      ignored.   In   order   to   prevent   an
 C$                      excessive number  of  lines  being  drawn
 C$                      because of  tiny PDIST(*)  values  (which
 C$                      might cause a pen plotter to cut  through
 C$                      the  paper),   a  minimal   distance   is
 C$                      enforced  internally,  corresponding   to
 C$                      MAXLIN (=1000 in a DATA statement)  lines
 C$                      across the box.
 C$    NPDIST............Number  of entries  in PDIST(*) (.GE. 1).
 C$                      Line K will be spaced a distance  PDIST(1
 C$                      + MOD(K-1,NPDIST)) from line K-1, so that
 C$                      PDIST(*) is  used circularly.   It is  an
 C$                      error if NPDIST .LE. 0.
 C$    THETA.............Angle  of  lines  (in  degrees)  measured
 C$                      counterclockwise from the X axis.
 C$    BOX............... .TRUE. - Draw the polygon outline.
 C$                      .FALSE. - Do not draw an outline.
 C$    ALPHA(N)..........REAL working array  for temporary storage
 C$                      of   line   segment   parameters   during
 C$                      clipping.
 C$
 C$    If an  increment  INCX,  INCY, or  INCZ  is  negative,  the
 C$    starting vertex is taken as (1-N)*INC + 1 instead of 1,  so
 C$    that the array is stepped through in reverse order.
 C$
 C$    In order to fill a 2-D polygon defined in 3-D  coordinates,
 C$    it is necessary to rotate the 3-D object into a 2-D  plane,
 C$    here chosen to be the XY plane.  The filling angle THETA is
 C$    then  measured  counterclockwise  from  the  base  of   the
 C$    smallest enclosing rectangle in  the XY plane.  Because  of
 C$    numerical roundoff problems, one  cannot in general  expect
 C$    the clipping of  the filling  line segments  against a  2-D
 C$    polygon in a 3-D plane to  succeed (such a line segment  is
 C$    unlikely  to  cross  the  polygon  edges  exactly),  it  is
 C$    necessary to clip them  against the 2-D  polygon in the  XY
 C$    plane, then  rotate them  into  the original  3-D  polygon.
 C$    This means that internal storage  is necessary for the  2-D
 C$    polygon.  We use  COMMON arrays XTEMP(*)  and YTEMP(*)  for
 C$    this purpose; they are also  used for temporary storage  by
 C$    PGNR2 and PGNR3, but their contents are not required  after
 C$    this routine is called.
 C$    (31-MAY-88)