|tkspline(3tk)||Tk Spline - An additional smoothing method for canvas items||tkspline(3tk)|
spline, - additional smoothing method for canvas items.
package require Tkspline ... .c create line ... -smooth spline ... .c create polygon ... -smooth spline ...
The new option value: -smooth spline provides an additional smoothing method to line and polygon canvas items.
Spline smoothing will revert to the builtin smoothing method unless the number of points is 3n+1, where n is the number of spline segments. (Normally in polygons this means 3n points because the last point of the spline is understood to be the same as the first in order to close the polygon).
In line and polygon items, the curves generated with the standard -smooth true option have the following properties:
- the curve is always tangential to a straight line between consecutive points.
- the curve is only guaranteed to intersect the first and last points of lines.
- the curve is not guaranteed to intersect any points of polygons.
With -smooth spline (and the right number of coordinates) the curves generated have the following different properties:
- the curve is guaranteed to intersect the first point, and every third point after that.
- each segment of the curve shares endpoints with the adjacent segments, but is otherwise independent of them.
- the curve is guaranteed to be tangential to a line between n and n+1 at point n, and also to a line between n+2 and n+3 at point n+3.
- the curve is not guaranteed to be smooth at the junctions between segments unless the shared point and the points either side of it are on a straight line.
These alternative properties are useful to some path planning algorithms.
The underlying Bezier code is in John Ousterhout's original canvas widget, this extension just provides an alternate interface to it. The hooks into the canvas are provided by Jan Nijtmans in his "dash" patch.
spline, line, polygon, bezier, canvas, widget
John Ellson, email@example.com