[MWForum](no subject)
Pavel Boytchev
mwforum@lists.mathcats.com
Mon, 16 Feb 2004 03:15:00 +0200
> >In probing why the number of sides relates to the angles
> >(having to add up to 360) what angles are refered to? I am
> >wanting to know why this is so.
If you draw a polygon with N sides, the turtle should definitely turn N
times. Because angles (orientation, turtle's heading) do not change
during FORWARD movement, the final orientation will be the same as if
the turtle only turns around (and does not move forward). So, if the
turtle stays on one place and makes N turns to the left, and if the
final orientation is the same as the initial one, then all turn angles
should have a sum = 360. If the angles are the same, then each of them
should be 360/N. Thus, the following code:
repeat :N [ fd 10 lt 360/:N]
will draw a square when N=4, and a pentagon when N=5, and the bigger the
N is, the more circle-like the polygon is.
This is a simplification of a more general phenomena.
[1] The overall turn angle is not necessarily equal to 360 degrees. It
can also be 360*K where K is integer number (0, 360, -360, 720,
-720,...) So if the overall turn angle is 360 degrees, this is just the
case when K=1
[2] If you have both left and right turns, you must convert all of them
into only left, or into only right (by using that LT :A = RT 0-:A). When
you calculate the total sum of angles (positive and negative angles),
the result must be 360*K if the final orientation is the same as the
initial one.
Pavel