lundi 10 février 2014

Drawing polygons in python turtle topic




(E-Mail Removed) Wrote in message:
> Hi
> can anyone help finding the angle to draw different polygons shapes
>
> in this example
>
> import turtle
> wm = turtle.Screen()
> alex = turtle.Turtle()
> for i in range(5):
> alex.left(216)
> alex.forward(50)
> wm.exitonclick()
>
> Why do we use 216
>


216 degrees doesn't seem to me that it would make a polygon, but
rather a star.

I can tell you what I remember about geometry, however. To make a
regular polygon, you need to turn by a fixed amount and go a
fixed distance each time.

For an equilateral triangle, you turn 120 degrees. For a square,
90. For a pentagon, 108.

180 - (360/n) degrees.


--
DaveA






Aucun commentaire:

Enregistrer un commentaire