home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
300
/
249
/
spline.arc
/
SPLINE.DOC
< prev
next >
Wrap
Text File
|
1986-10-28
|
4KB
|
109 lines
NAME
spline - interpolate using splines under tension
SYNOPSIS
spline [file] [options]
DESCRIPTION
Without options, SPLINE reads pairs of numbers (x- and y-values) from
the standard input (or the given file), generates a smooth curve
through the points, and writes to the standard output points from the
smooth curve. The curve is a spline under tension (see references),
which is somewhat "tighter" than a cubic spline, and less
likely to have spurious inflection points. As with GRAPH, each
pair of points may optionally be followed by a comment. If the
comment is surrounded by quotes "...", the comment may contain
spaces. The given points, and their comments if any, will be
included in the output. The interpolation may optionally be
restarted after each label, so that a family of curves may be
processed together (see the -b switch).
Input lines starting with ";" are copied to the beginning of
the output file but are otherwise ignored. Blank lines are
ignored.
If the -c switch is not used, the input points must be from a function
- that is, the x values must be strictly increasing. The
output points will also be from a function. (If the -b switch
is used, this restriction applies only within each segment.)
If the -c switch is used (indicating a general curve), the
input points need not be from a function, but each pair of
points must be separated from the previous pair by a finite
distance. (If the -b switch is used, this restriction applies
only within each segment.)
options are:
-a [step [start]] Input data contains only y values - generate automatic
abscissas at intervals of step (default 1) starting at start
(default 0).
-b break the interpolation at each label. That is, the input
curve is divided into sections with the last point in
each section marked by a label (which may be empty:
""). A separate interpolating curve is to be found for
each section. In this case, the requirements on the
number of intervals (specified by the -n switch or
defaulted) and the interpolation range (specified by the
-x switch) are applied to each section independently.
-c general curve rather than function. In this case, the
curve is parameterized on the polygonal arclength from
the first to the last given point, with the whole
length scaled to be 1. Thus, the values min and max
for the -x switch should satisfy 0 <= min < max <= 1.
The -s and -c switches cannot be used together.
-i file
interpolate at x values given in file. Only 1st number
on each line of file is used - rest of line is ignored.
Blank lines and lines starting with ';' are ignored.
-n num interpolate over num intervals (default is 100)
-q Quadruple: increase the number of intervals fourfold.
-s [num [num]]
Specify slopes at beginning and end of curve. Slopes
not given are assumed to be zero. Without the -s
switch, slopes are determined from other information.
The -s and -c switches cannot be used together.
-t num Specify tension in interpolating curve. Tension of 50 gives
almost polygonal line, tension of .01 gives almost cubic
spline. Tension must be positive. Default is 1.
-x [min [max]]
Interpolate from min to max only. min and max should
be in the range of the given x values, except that if
the -c switch is used they should satisfy 0 <= min <
max <= 1.
-xl take log of x values before interpolating, take exponential
afterwards (probably necessary if -xl switch is needed for
GRAPH)
-yl take log of y values before interpolating, take exponential
afterwards (probably necessary if -yl switch is needed for
GRAPH)
NOTES
Similar to the Unix routine, except using splines under tension,
passing labels through, performing multiple interpolations from
one file and allowing general curves.
REFERENCES
A. K. Cline, "Scalar- and Planar- Valued Curve Fitting Using
Splines Under Tension", Communications of the ACM v 17 n 4 p
218-223 (Apr 74).
Schweikert, D. G. "An interpolation curve using a spline in
tension", J. Math. and Physics v 45 p 312-317 (1966).
AUTHOR
Copyright (c) 1985 James R. Van Zandt
Resale forbidden, copying for personal use encouraged.