views:

262

answers:

1

I'm trying to draw a curve through multiple points (more than 3) .
I tried to draw those points using available lineTo(), bezierCurveTo().

Could anyone help me solve this ? May be there is some workaround to draw this using arc() function ?

A: 

Bezier splines do not (necessarily) go through their control points, but Catmull-Rom splines do. They require an extra pair of control points beyond the set that you want to interpolate (one before, one after).

The CakeJS package (http://code.google.com/p/cakejs/) has a Catmull-Rom facility, though I don't know much about it other than that it apparently exists.

Pointy
Thanks for the hint. but the Catmull-Rom facility in CakeJs does not work as I expected. It does draw a Catmull-Rom line but for 4 and more points and a closed one only.
slava
Well, that's sort-of the deal with Catmull-Rom splines. I'm not in any way a mathematician and my memory is fuzzy anyway, but I think that the way the equations work it really doesn't make sense with less than 4 points. I've implemented Catmull-Rom a couple times, and even for dumb me it wasn't that hard; maybe you could adapt it.
Pointy