Previous: utrp2 Up: ../plot79_u.html Next: utrpsz
SUBROUTINE UTRPP3 (A,B,C,D,X,INCX,Y,INCY,Z,INCZ,N) C$ (Polygon Plane - 3-D) C$ Determine the equation, Ax + By + Cz + D = 0, of the plane C$ in which a 3-D planar polygon lies. A right-handed C$ coordinate system is assumed. The arguments are: C$ C$ A,B,C,D...Plane constants (returned). C$ X(*)......Array of absolute X coordinates of polygon C$ vertices. C$ INCX......Displacement between successive X values in X(*) C$ (normally 1). C$ Y(*)......Array of absolute Y coordinates of polygon C$ vertices. C$ INCY......Displacement between successive Y values in Y(*) C$ (normally 1). C$ Z(*)......Array of absolute Z coordinates of polygon C$ vertices. C$ INCZ......Displacement between successive Z values in Z(*) C$ (normally 1). C$ N.........Number of data points defining the polygon. The C$ polygon is automatically closed by connecting C$ point N to point 1. A move will be done to the C$ point 1 before beginning to draw the polygon. C$ C$ The equation of the plane, A*x + B*y + C*z + D = 0, can in C$ principle be determined by finding the vector (A,B,C) equal C$ to the cross product of any two non-colinear edges. C$ Unfortunately, the accuracy of this may suffer if the edges C$ are almost colinear, and it may also require a search to C$ find such a pair. The following algorithm using all C$ vertices to determine the plane is attributed to Martin C$ Newell in I.E. Sutherland, R.F. Sproull, and R.A. C$ Schumacker, "A Characterization of Ten Hidden-Surface C$ Algorithms", ACM Comp. Surveys 6, 1-55 (1974), p. 15. We C$ compute the constant term D from an average of the values C$ at each vertex, and carry out intermediate calculations in C$ DOUBLE PRECISION. C$ C$ When the viewer faces the polygon from the side on which C$ the vertices occur in counterclockwise order, the normal C$ vector (A,B,C) points toward the viewer. This facilitates C$ definition of exterior and interior polygon faces, which is C$ essential in hidden surface algorithms. C$ (21-APR-83)