[Tutor] Using trigonometry to draw a circle

Roel Schroeven roel at roelschroeven.net
Tue May 18 16:43:11 EDT 2021


Phil schreef op 18/05/2021 om 10:30:
> On 18/5/21 6:12 pm, Joel Goldstick wrote:
>> On Tue, May 18, 2021 at 3:23 AM Phil <phillor9 at gmail.com> wrote:
> That should have been:
> 
> x = math.cos(angle * 6.28 / 360) * radius + x_centre

Even better: Python has a function for converting degrees to radians:

x = math.cos(math.radians(angle)) * radius + c_centre

There's also math.degrees() for the reverse operation, converting 
radians to degrees.


-- 
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
         -- Franklin P. Jones

Roel Schroeven



More information about the Tutor mailing list