What's the best way to draw an arc using only x-y position movements? For example let's say I want to draw a circle with开发者_如何学JAVA radius 4 at point (4,4). Let's saw my "drawer" starts at (4,0) and a resolution of .1 steps in each direction. How would I create a sequence of movements to complete the circle?
If that's not clear I can try to explain better.
If I understand your question properly, you are looking for Bresenham's algorithm. You can read about it here, for example.
You want the midpoint circle algorithm, also known as Bresenham's circle algorithm (even though Bresenham didn't develop it). Wikipedia has a reasonably good article about it; there was also a Python implementation on the LiteratePrograms wiki (which is no more – the link is to the Wayback Machine), and several implementations on Rosetta Code. The idea behind it is to walk in a circle, successively computing each coordinate from the previous one (avoiding more expensive math operations). You always move in one direction (say "up"), and use the computed variable to decide whether or not to turn.
精彩评论