Previous: fitp2 Up: ../plot79_f.html Next: fitpb3


FITPB2

       SUBROUTINE  FITPB2 (XFIT, YFIT, NFIT, MAXFIT, X, Y, N, K1, KN,
      X     NEXTRA)
 C$    (Overhauser Parabolic Blend 2-D)
 C$    Make an Overhauser parabolic  blend curve fit  to a set  of
 C$    2-D points.  The points may be positioned arbitrarily,  and
 C$    need  not  correspond  to  a  single-valued  function.   An
 C$    Overhauser curve passes  through the  original points,  and
 C$    forms a smooth approximation along their general direction.
 C$    For any 4 consecutive points,  the curve is constructed  by
 C$    joining a parametric quadratic passing through the first  3
 C$    points with one passing through the last 3.  The Overhauser
 C$    fit has several useful properties:
 C$
 C$         The Overhauser fit is a  local one, and a  change
 C$         in the K-th data point will affect the curve only
 C$         along the  four line  segments K-2..K-1,  K-1..K,
 C$         K..K+1, and K+1..K+2.
 C$
 C$         If the data points  are distinct, the  Overhauser
 C$         curve is  continuous  in its  zeroth,  first  and
 C$         second  derivatives  between   the  points,   and
 C$         continuous in its zeroth and first derivative  at
 C$         the data points.  If two adjacent data points are
 C$         identical, its first derivative is  discontinuous
 C$         at that point; if three are identical, the  curve
 C$         itself is discontinuous.
 C$
 C$         An Overhauser curve  generated for N  consecutive
 C$         points is the  same as that  for the same  points
 C$         taken in reverse order (???).
 C$
 C$    The Overhauser curve is thus a useful tool in curve design,
 C$    since simple  experimentation with  individual data  points
 C$    can be used to obtain any desired curve shape.  Because the
 C$    data points lie on the curve, rather than off it, as is the
 C$    case for  B-spline and  Bezier curves,  positioning of  the
 C$    data points may be easier.  On the other hand, it does  not
 C$    possess the convex hull property of the B-spline and Bezier
 C$    curves.  Like the  latter, the  Overhauser fit  generalizes
 C$    easily to 3-D and 4-D space curves.
 C$
 C$    The output arguments are:
 C$
 C$    XFIT(*),
 C$    YFIT(*)........Output data points.
 C$    NFIT...........Number of points  actually stored in XFIT(*)
 C$                   and YFIT(*) (will  not exceed MAXFIT).   The
 C$                   points will be  distributed at intervals  of
 C$                   approximately equal  arc  length  along  the
 C$                   curve.
 C$
 C$    The input arguments are:
 C$
 C$    MAXFIT.........Limit on number of points desired in XFIT(*)
 C$                   and YFIT(*).
 C$    X(*),Y(*)......Original data points.
 C$    N..............Number of original data points.
 C$    K1.............Number  of times  to implicitly  repeat  the
 C$                   first original data  point.  If  out of  the
 C$                   range 0..2, the  nearer of  0 or  2 will  be
 C$                   used.
 C$    KN.............Number  of times  to  implicitly  repeat the
 C$                   last original data  point (point  N+NEXTRA).
 C$                   If out of the range 0..2, the nearer of 0 or
 C$                   2 will be used.
 C$    NEXTRA......... .LE. 0 - Use exactly N data points.
 C$                    .GT. 0 - Use N+NEXTRA data points, wrapping
 C$                             around  in  the  arrays  X(*)  and
 C$                             Y(*), so that position N+K indexes
 C$                             the array at position K  (actually
 C$                             at mod(N+K-1,N)+1).
 C$                   If NEXTRA  is out  of  the range  0..N,  the
 C$                   nearer of 0 or N will be used.
 C$
 C$    If the first three points are  the same as the last  three,
 C$    the Overhauser  curve will  be a  continuous closed  curve.
 C$    Thus, given a set of  points defining a polygon, where  the
 C$    last is  implicitly  connected  to the  first,  by  setting
 C$    NEXTRA =  3, one  can  generate a  fit  which itself  is  a
 C$    polygon.
 C$
 C$    References:
 C$    J.A. Brewer and  D.C.  Anderson,  "Visual Interaction  with
 C$    Overhauser Curves and Surfaces", Computer Graphics 11,  No.
 C$    2, 132-137  (1977).  The  formulation below  is taken  from
 C$    this article.
 C$
 C$    D.F. Rogers  and  J.A. Adams,  "Mathematical  Elements  for
 C$    Computer Graphics", McGraw-Hill (1976), pp. 133-138.
 C$    (09-APR-82)