Home > Degrafa > Degrafa Quadratic Spline Released

Degrafa Quadratic Spline Released

March 12, 2009

Well, once again I made changes to the tension algorithm.  Interior knots in the quadratic spline serve as control points for individual quadratic Bezier segments.  Anchor points are positioned along the line segments between knots.  It is not possible to move the spline away from one knot without moving it closer to the next knot in sequence.  This effect is somewhat balanced out by using a tension parameter in the middle of the range, say 0.3 to 0.6.  A tension of 0.4 is shown in the screenshot below.

Quadratic Spline, tension 0.4

Quadratic Spline, tension 0.4

As the tension goes to zero, the spline moves away from the first interior knot at the expense of exactly interpolating the second.  It moves away from the third interior knot at the expense of exactly interpolating the fourth, and so on as shown below.  This actually allows cusps to be created with the spline, something not possible with the cubic Beziers spline.

Quadratic spline with a cusp

Quadratic spline with a cusp

As the tension moves from the midrange to 1, the spline progressively approaches straight-line segments from knot to knot.  This allows the quad. spline to be used for a variety of drawings that are not possible with the cubic Bezier spline.

A simple online demo is available (first update your SVN – Origin branch).  Position the cross-hair in the drawing area and click to define knots.  After three knots are defined, the spline is automatically drawn.  You can adjust the tension in MXML and recompile to test tension changes.

View demo.

View source.

Categories: Degrafa Tags: , , ,
%d bloggers like this: