At the moment I have a program that demonstrates hypotrochoids and epitrochoids (aka Spirograph http://www.math.psu.edu/dlittle/java/parametricequations/spirograph/index.html ).
At first I was drawing the shape using just straight lines, but realised the jagged edges wer开发者_运维问答en't so good. I then introduced a curveTo() Bezier curve using two iterations of circular rotations (and resulting x, y points), one for the control point and one for the endpoint (a quadratic curve).
Now the shape is curvier but it's still not curvy enough, it still has some sharp angles instead of a smooth shape.
Does anyone know how I can render a more curved line, using either the curveTo() method or some other implementation for having constant curves?
I was thinking maybe using the circular tangential across the jagged edge, and then replacing the current line with the part of the circle that is tangential.
How could I go about implementing something like that?
EDIT:- I should add that I'm using the animation thread to render the lines.
The image shows that only segments of the line are curved http://dl.dropbox.com/u/12814074/Screen%20shot%202011-04-02%20at%2007.31.56.png
It sounds like the control points should be tangential to the curve. If you're just using another point on the curve, this is not the case. Try placing the control point where the tangents of 2 points meet:
P.S. What do you mean "using the animation thread"?
精彩评论