Smooth Curves

Hi, folks-

I was talking with Kevin Lindsey this weekend (some of you will remember 
him from the SVG-Developers list), and I was describing the Catmull-Rom 
curves [1] we're planning to add to SVG2. Reminded me of another 
pass-through-all-points technique by Robert G. Edwards (from The 
MapTools Company) posted to the Yahoo SVG-Developers list [2].

The original [3] was no longer online, but Kevin retrieved it from the 
WayBack Machine, retooled the example to work in modern browsers (it had 
some Adobe SVG Viewer quirks), and sent me a working version [4].

Here's what Robert Edwards wrote for the earlier Java implementation of 
the technique [5]:
[[
Click on and move around any of the points that are being interpolated. 
The curve is redrawn as points are moved. For a brief explanation of 
what is going on, read on.

We use a relaxed cubic spline to interpolate the six points. This means 
that between each two points, there is a piecewise cubic curve. When we 
string these curves together, we set the second and first derivatives at 
the endpoints of each piecewise cubic curve equal to that of the 
adjacent cubic curve's second and first derivatives thus providing for a 
continuous second derivative. This gives a smooth curve that passes 
through each point, thus interpolating them. The term "relaxed" is used 
because the endpoints of the cubic spline have their second derivative 
equal to zero.
]]


I still prefer the Catmull-Rom approach, since changing any segment only 
affects segments immediately adjacent [6], but I thought this was worth 
pointing out as an alternate approach.


[1] http://schepers.cc/getting-to-the-point
[2] http://tech.groups.yahoo.com/group/svg-developers/message/596
[3] 
http://web.archive.org/web/20040207114017/http://home.earthlink.net/%7Eedwardsrg/Adobe/spline.html
[4] http://schepers.cc/svg/path/spline.svg
[5] 
http://web.archive.org/web/20040118213004/http://home.earthlink.net/~edwardsrg/Adobe/JavaSpline.html
[6] http://schepers.cc/svg/path/dotty.svg

Regards-
-Doug

Received on Monday, 13 May 2013 16:30:27 UTC