CURVATURE Description:
Purpose:
CURVATURE serves two purposes: The first purpose is to estimate
the curvature, k(s), at each point along a given curve in 2-space
using parametric methods, where s is the arc length along the curve.
Four methods are provided for estimating the necessary derivatives:
the finite-differencing method, the conventional cubic spline,
the quasi-Hermite cubic spline, and the monotonic cubic spline. Both
the quasi-Hermite and monotonic splines prove poor as their lack of
continuous 2nd derivatives would suggest, but they are retained for
illustrative purposes. The results are saved in QPLOTable form:
y vs. x, x vs. s, y vs. s, and k vs. s, any of which may be suppressed.
The second purpose of CURVATURE is to serve as a driving program
for the subroutine CURVDIS, which is presented as an alternative to
estimating and plotting local curvatures. This option redistributes
the points of the input curve with local curve spacing more or less
inversely proportional to the local curvature for any specified number
of output points. Three scaling options are provided since curvature
magnitudes are sensitive to the units and CURVDIS expects data of order 1.
This program began as a pedagogical exercise practicing Sterling
Software's programming style. It has evolved into a convenient utility
for displaying curvature or redistributing points for (say) airfoils.
Method:
The program reads in points from a file with a "SMOOTH" format:
[title and number of points in records 1 and 2, now optional, followed
by] columns of (x,y) pairs; any further columns are ignored.
As the first step in displaying curvature, "PLFIT" computes the
cumulative chord lengths, which serve as the parametric variable, s.
Derivatives with respect to s may be estimated in several ways. For
the conventional cubic spline option, "CSFIT" calculates the spline
coefficients - first for x vs. s, and then for y vs. s. After each
"CSFIT" call, "CSDVAL" computes the 1st and 2nd derivatives (dx/ds,
d2x/ds2, dy/ds and d2y/ds2) at each point. The magnitude of the
local curvature is then determined from:
|k(s)| = sqrt ((d2x/ds2)**2 + (d2y/ds2)**2)
The signs (+/-) of the curvatures are determined by the sign of the
expression:
d2y/ds2 * dx/ds - d2x/ds2 * dy/ds
For the quasi-Hermite spline fit, the same steps are taken with "QHSFIT"
used instead of "CSFIT." And for the monotonic cubic spline, "MSFIT" is
used in place of "CSFIT." For the finite differencing method, values of
x vs. s and y vs. s are given to "FD12K", which generates the derivatives
directly. Then k(s) is evaluated as before.
To redistribute points according to the local curvature, the user
may first normalize the input coordinates such that: 1) both x & y are
in the range [0,1], 2) the coordinates are around the range [0,1], but
the geometric shape is retained, or 3) the coordinates are normalized
in precisely the same way as data from another geometric curve. Or,
the user may elect not to rescale the data at all. After the optional
rescaling, "CURVDIS" distributes the specified number of points along
the curve, with a fractional exponent provided to vary the clustering
effects. Results are scaled back to the original units if necessary and
saved in plottable form.
History:
08/16/88 BAN/DAS Initial design & implementation for XY data.
09/14/88 BAN Installed subroutine CURVDIS.
11/02/88 DAS A few refinements in readiness for an XYZ analog.
12/02/88 MDW Modularized curve normalization procedures.
08/27/91 DAS Installed CURV2D in place of in-line code.
10/05/91 DAS Provided for plotting Curvature vs. X or vs. S;
replaced IMSL's IQHSCU with QHSFIT.
10/25/91 DAS CURV2D had an "NPTS" argument added (loop inside).
10/15/03 DAS Added output of radius of curvature and X as further
columns for the curvature vs. arc length option.
09/02/08 DAS Input data header records are now optional.
12/03/10 DAS CURVDIS can now smooth its shape function and/or
the redistributed arc lengths.
12/07/10 DAS CURVDIS can now output redistributed arc lengths,
as needed by HEAT_SHIELD. Save them for possible
comparison with DISTRIBUTE results on [0, 1].
03/06/13 DAS 8 (not 7) digit output matches CAPSULE_GRID.
Authors: Brian Nishida, NASA Ames/Sterling Software, Moffett Field, CA.
David Saunders, NASA Ames/Sterling Software/ERC, Inc.
Final Note:
Finite difference derivatives are recommended for most purposes. The
local spline second derivatives are not guaranteed to be continuous across
the data points, and are an option for illustrative purposes only.