Previous: clppl2 Up: ../plot79_c.html Next: clpsh2
SUBROUTINE CLPPL3 (NORMAL, XOLD, INCX, YOLD, INCY, ZOLD, INCZ,
X NOLD, XNEW, YNEW, ZNEW, NNEW, MAXNEW)
C$ (3-D Polygon Clip to Plane)
C$ Clip a 3-D polygon to the visible side of a plane defined
C$ by its normal vector. The output of the clip is a new
C$ polygon. Repeated calls can be used to clip a polygon
C$ successively against a window boundary. The arguments are:
C$
C$ NORMAL(*)......Normal (A,B,C,D) defining equation of plane
C$ Ax + By + Cz + D = 0. The normal points to
C$ the visible side of the plane.
C$ XOLD(*)........x coordinates of polygon vertices.
C$ INCX...........Increment between successive coordinates in
C$ XOLD(*) (normally 1).
C$ YOLD(*)........y coordinates of polygon vertices.
C$ INCY...........Increment between successive coordinates in
C$ YOLD(*) (normally 1).
C$ ZOLD(*)........z coordinates of polygon vertices.
C$ INCZ...........Increment between successive coordinates in
C$ ZOLD(*) (normally 1).
C$ NOLD...........Number of polygon vertices. Vertex NOLD is
C$ implicitly connected to vertex 1 to close
C$ the polygon.
C$
C$ The output arguments are:
C$
C$ XNEW(*)........x coordinates of clipped polygon vertices.
C$ YNEW(*)........y coordinates of clipped polygon vertices.
C$ ZNEW(*)........z coordinates of clipped polygon vertices.
C$ NNEW...........Number of clipped polygon vertices. Vertex
C$ NNEW is implicitly connected to vertex 1 to
C$ close the polygon. NNEW will usually be
C$ less than NOLD, but it may be as large as
C$ (3*NOLD+1)/2. This case arises when
C$ adjacent vertices lie on opposite sides of
C$ the clipping plane, with NOLD/2 visible and
C$ (NOLD+1)/2 hidden; each hidden vertex
C$ contributes two new vertices on the clipping
C$ plane, giving a total of NOLD+1 new
C$ vertices, which added to the NOLD/2 old ones
C$ is (3*NOLD+1)/2.
C$ MAXNEW.........Maximum number of vertex entries available
C$ in XNEW(*), YNEW(*), and ZNEW(*). NNEW is
C$ not permitted to exceed this value.
C$
C$ If an increment INCX, INCY, or INCZ is negative, the
C$ starting vertex is taken as (1-NOLD)*INC + 1 instead of 1,
C$ so that the array is stepped through in reverse order.
C$
C$ The algorithm is a variant of the reentrant polygon clipper
C$ originally proposed by I.E. Sutherland and G.W. Hodgman,
C$ "Reentrant Polygon Clipping", Comm. ACM 17, 32-42 (1974),
C$ in a formulation due to T. Pavlidis, "Algorithms for
C$ Graphics and Image Processing", Computer Science Press
C$ (1982), Algorithm 15.3, p. 348. However, Pavlidis'
C$ intersection computations are reformulated using the dot
C$ product parametric line techniques used in CLPPG3.
C$ (18-DEC-82)