http://u.snelhest.org/i/2010/07/06_3754.png I'm trying to draw this picture in JES, Jython. I've forgotten some of the basic math from school, so it's kind of difficult .
I've done the full circle, but i'm not sure how to continue from there.
Each rectangle, half-circle and circle is inset by 10 pixels, and the picture is a 200x200 square.
addRect, addOva开发者_开发问答l and addArc are the given hints.
addArc(picture, startX, startY, width, height, start, angle[, color]):
addOval(picture, startX, startY, width, height[, color]):
addRect(picture, startX, startY, width, height[, color]):
(I'm assuming this is a homework problem)
Can you draw the shape out by hand and document what you're doing? Write out the start coordinate, apex and end coordinate of each arc, or at least as many as you need to see a pattern. That's always a good place to start because if you can draw it out and get some of the coordinates, all you'll need to do is convert to JES syntax.
Since the changes in the arc sizes and positions are regular over the figure, you should be able to use a loop to draw each half circle. You can do a single loop that draws even numbered arcs opening down and odd numbered arcs opening up but I think it's easier to have one loop for the arcs opening up and a second for arcs opening down.
精彩评论