RE: Smooth Curves

Yes, Doug,

In fact similar things have been posted intermittently over many years on svg-developers, with the use of extant methods to allow SVG to pass cubic Beziers through user-defined points. Providing a history of such posts would merely point to the recurrence of and interest in the use-case.

I would agree that having a method to allow the user-defined points to intuitively correspond to the points that appear in the markup makes sense. I'm not quite sure how Catmull-Rom does it better than other approaches, although one does need script to augment the SVG curves to do this at present. 

It seems like the current approach to SVG is to just use script to do everything and not to enhance SVG in any significant way, so I'm not sure how helping script-challenged authors should be leveraged here and not in other ways.

I feel a need to fuss from time to time, else SVG will be grown only by people who work for browser developers.

Cheers
David

-----Original Message-----
From: Doug Schepers [mailto:schepers@w3.org] 
Sent: Monday, May 13, 2013 12:30 PM
To: SVG public list
Cc: Kevin Lindsey
Subject: 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 23:52:19 UTC