Previous: fitpl2 Up: ../plot79_f.html Next: fitpo1
SUBROUTINE FITPL3 (XNEW,YNEW,ZNEW,NPNEW, X,Y,Z,NP, DELTA) C$ (Fit - Polyline 3-D) C$ Given a set of points (X(I), Y(I), Z(I), I = 1,NP) forming C$ a 3-D space curve, find a new set of points (XNEW(I), C$ YNEW(I), ZNEW(I), I = 1,NPNEW), which is smaller if C$ possible by eliminating consecutive colinear, or almost C$ colinear, segments. C$ C$ The output arguments are: C$ C$ XNEW(*)........New X values returned. C$ YNEW(*)........New Y values returned. C$ ZNEW(*)........New Z values returned. If the old values C$ need not be preserved, XNEW(*), YNEW(*), and C$ ZNEW(*) may be the same arrays as X(*), C$ Y(*), and Z(*) respectively. C$ NPNEW..........Number of new (X,Y,Z) pairs returned. Space C$ must be available in XNEW(*), YNEW(*), and C$ ZNEW(*) to store at most NP items, since C$ NPNEW .LE. NP on return. C$ C$ The input arguments are: C$ C$ X(*)...........Old X values. C$ Y(*)...........Old Y values. C$ Z(*)...........Old Z values. C$ NP.............Number of old (X,Y,Z) values. C$ DELTA..........Maximum deviation between the data points C$ and the required vector approximation, C$ measured relative to the line segment C$ lengths in order so that it is independent C$ of the scale of the input data. C$ C$ It is assumed that X, Y, and Z are approximately equally C$ scaled, so that distance computations can be done without C$ undue accuracy loss. Internal scaling is done according to C$ the curve arclength, so that the range of X, Y, and Z can C$ approach the underflow and overflow limits of the host C$ machine without causing errors. C$ C$ This routine may prove useful in determining a reduced set C$ of points which can satisfactorily represent a much larger C$ set, but for which plotting time is excessive. This will C$ generally be the case for points entered from a digitizer. C$ C$ The output set of points is always a subset of the input C$ point set, and contains the same first and last points. C$ Thus, if the input points are integral values, the output C$ points will be too. C$ C$ In the case of polygons, the last input point point should C$ be identical to the first one. If this point lies only C$ slightly off the line segment connecting its adjacent C$ neighbors, it could possibly be eliminated. Thus, for C$ polygons, one should call this routine twice using C$ different start points, then select the smaller output set. C$ C$ The algorithm is the split-and-merge one given by C$ C$ Theo Pavlidis, "Algorithms for Graphics and Image C$ Processing", Computer Science Press (1982), pp. 281-292. C$ C$ straightforwardly extended from 2-D to 3-D, but only the C$ distance of points from the approximating line segments is C$ considered, not the sign changes in the distances. C$ (28-DEC-83)