[Tutor] Using trigonometry to draw a circle

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 18 04:40:59 EDT 2021


On 18/05/2021 08:21, Phil wrote:
> While this question is not exactly Python related, I'm trying to 
> understand how I can incorporate trig functions into Python code.
> 
...
> 
> Increasing the steps in the range function adds more points to the 
> circle, but still draws a full circle. How would I draw part of a circle 
> by giving a function the starting and ending angles along the circumference?

You already have the general answer but I'd point out that many plotting
and drawing libraries have functions for drawing arcs which are easier
and much faster than drawing individual pixels.

Also some math plotting libraries will plot a function so you
don't have to. But that only helps if you are restricted to drawing
graphs, you still need to use the math functions when manipulating data.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list