tclspline is a port of the spline routines from the Tk canvas widget, made callable on coordinate lists and made into a TEA-compliant Tcl C extension.


spline nSteps pointList

spline_raw nSteps pointList


Input is an integer number of steps, nSteps, and a list containing three or more pairs of x and y coordinates. spline reads that list and generates a new list of x and y coordinate pairs representing a curve based on the passed points, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second and third, and so on.

Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment.

spline_raw indicates that the list should also be returned as a curve, but the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve.

Straight line segments can be generated within a curve by making control points equal to their neighboring knot points. If the last point is a control point and not a knot point, the point is repeated (one or two times) so that it also becomes a knot point.

nSteps specifies the degree of smoothness desired for curves; each spline will be approximated with nSteps line segments.


Format: source code, a gzip of a tar archive.


Project: , that is flightaware-tcltools