What Links Here?
Outbound Links
Polygon
I remember a maths teacher saying to me, "It's amazing how clear it is, when you use Logo, that a circle is just a polygon with an infinite amount of sides"
In that spirit, here's a simple formula for a polygon.
Repeat {sides}: Forward {length}, Right Turn 360/{sides}.
I tried running this program with an infinite number of sides. It fell over in less than a minute and I never did see a circle.
As the number of sides goes from 3 up to 39, we see the shape becoming more and more circle-like.
to poly :sides :length repeat :sides [ fd :length rt 360/:sides ] end reset home setxy 50 400 poly 3 50 poly 4 50 poly 5 50 poly 6 50 poly 7 50 poly 8 50 poly 9 50 poly 10 50 poly 11 50 poly 12 50 poly 13 50 poly 14 50 poly 15 50 poly 16 50 poly 17 50 poly 18 50 poly 19 50 poly 20 50 poly 21 50 poly 22 50 poly 23 50 poly 24 50 poly 25 50 poly 26 50 poly 27 50 poly 28 50 poly 29 50 poly 30 50 poly 31 50 poly 32 50 poly 33 50 poly 34 50 poly 35 50 poly 36 50 poly 37 50 poly 38 50 poly 39 50
No logo-based investigation of the polygon is complete without discussing the polypoly. This is the shape created when a polygon with X sides is drawn, but where each side is a polygon with Y sides.
to poly :sides :length repeat :sides [ fd :length rt 360/:sides ] end to polypoly :num :length :sides repeat :num [ poly :sides :length pu fd :length pd rt 360/:num ] end reset home setxy 50 100 polypoly 3 50 3 setxy 200 100 polypoly 3 50 4 setxy 350 100 polypoly 3 50 5 setxy 500 100 polypoly 3 50 6 setxy 50 250 polypoly 4 50 3 setxy 200 250 polypoly 4 50 4 setxy 350 250 polypoly 4 50 5 setxy 500 250 polypoly 4 50 6 setxy 50 400 polypoly 5 50 3 setxy 200 400 polypoly 5 50 4 setxy 350 400 polypoly 5 50 5 setxy 500 400 polypoly 5 50 6 setxy 50 550 polypoly 6 50 3 setxy 200 550 polypoly 6 50 4 setxy 350 550 polypoly 6 50 5 setxy 500 550 polypoly 6 50 6 setxy 50 700 polypoly 7 50 3 setxy 200 700 polypoly 7 50 4 setxy 350 700 polypoly 7 50 5 setxy 500 700 polypoly 7 50 6
And here is its companion set — with polygons on the outside of each line, instead of the inside —
reset setxy 50 495 to poly :sides :length repeat :sides [ fd :length lt 360/:sides ] end to polypoly :num :length :sides repeat :num [ poly :sides :length pu fd :length pd rt 360/:num ] end reset home setxy 50 100 polypoly 3 20 3 setxy 200 100 polypoly 3 20 4 setxy 400 100 polypoly 3 20 5 setxy 650 100 polypoly 3 20 6 setxy 50 250 polypoly 4 20 3 setxy 200 250 polypoly 4 20 4 setxy 400 250 polypoly 4 20 5 setxy 650 250 polypoly 4 20 6 setxy 50 400 polypoly 5 20 3 setxy 200 400 polypoly 5 20 4 setxy 400 400 polypoly 5 20 5 setxy 650 400 polypoly 5 20 6 setxy 50 550 polypoly 6 20 3 setxy 200 550 polypoly 6 20 4 setxy 400 550 polypoly 6 20 5 setxy 650 550 polypoly 6 20 6 setxy 50 700 polypoly 7 20 3 setxy 200 700 polypoly 7 20 4 setxy 400 700 polypoly 7 20 5 setxy 650 700 polypoly 7 20 6 setxy 50 850 polypoly 8 20 3 setxy 200 850 polypoly 8 20 4 setxy 400 850 polypoly 8 20 5 setxy 650 850 polypoly 8 20 6 setxy 50 1000 polypoly 9 20 3 setxy 200 1000 polypoly 9 20 4 setxy 400 1000 polypoly 9 20 5 setxy 650 1000 polypoly 9 20 6
This line of thinking quickly takes you in the direction of asking: "What if each side of the polygon was itself a polygon, including the sides of the polygons within the polygons.... etc." which ends up with a rendition of the Sierpinski Polygon, or N-Flake as it is sometimes known.