The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   How exactly does Graffle interpolate Bezier curves? (http://forums.omnigroup.com/showthread.php?t=4051)

 dylans 2007-07-03 01:28 PM

How exactly does Graffle interpolate Bezier curves?

I would like to use OmniGraffle as a GUI, whereby the user uses Graffle to draw a series of curves (i.e. curved arrows).

After I collect the point coordinates used to generate a given curve, I would like to use that information to, for example, calculate the length of a curve, coordinates of points along the curve, radius of curvature at points along the curve, etc. To do this I would like to know precisely how Graffle generates these curves.

Nearly all Bezier algorithms employ control points (handles) in addition to the interpolating points. Does anyone know how Graffle draws the curves using only interpolating points?

-Dylan

 Wim Lewis 2007-07-03 09:58 PM

Graffle uses a cardinal spline interpolation with α=1/2 (which I think is the same as a Catmull-Rom spline with tension=0, but don't quote me on that).

 dylans 2007-07-09 10:51 AM

does not seem to be catmull-rom

Thank you for the suggestion. It seems as though Graffle is similar to Catmull-Rom in that a curve is interpolated based on the two points to the left of it and the two points to the right. However, using the catmull-rom algorithm described at:

[url]http://www.mvps.org/directx/articles/catmull/[/url]

I was unsuccessful.

For example, given the point list:
{{101, 248}, {211, 218}, {276, 149}, {336, 601}},
one of the points interpolated between the second and third point above should be {247.242462, 130.257446}, but using the algorithm referenced above, I was unable to obtain a point close to that.

If anyone has any ideas, I would be most grateful.

-Dylan

 Greg Titus 2007-07-09 12:24 PM

Wim kind of says it backwards. A cardinal spline has a tension, and Graffle uses a tension=0.5. A cardinal spline of tension=0 is the same as a Catmull-Rom spline.

See here: [URL="http://en.wikipedia.org/wiki/Cardinal_spline"]http://en.wikipedia.org/wiki/Cardinal_spline[/URL]

 All times are GMT -8. The time now is 10:29 PM.