Wednesday, 14 August 2013

Graphing a polar curve with uniform speed

Graphing a polar curve with uniform speed

I would like to draw an animation of a polar curve (a spiral) being
graphed. I am using javascript and canvas. Currently, I am using
setInterval to call a draw function, which graphs an x and y coordinate
found from a parametric representation of the polar curve (x and y in
terms of theta). I am incrementing theta by 0.01, from 0 to 2*pi, once for
every call to draw(). The problem is that I wish for the animation to draw
the same amount of the curve for each call to draw, so that the drawing
appears to progress with uniform speed. It doesn't matter if the time
between each call to draw is different; I just need the speed (in terms of
pixels drawn / # of calls to draw) to be constant for the entire awing. In
other words, I need the arc length of the segment of the polar graph drawn
for each call to draw to be the same. I have no idea how to go about this.
Any help/sugestions would be greatly appreciated. Thanks

No comments:

Post a Comment