Last active
August 29, 2015 14:19
-
-
Save adusak/e195f17f75352e8f2dd0 to your computer and use it in GitHub Desktop.
Grid circle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt | |
| from python.common.Turtle import Turtle | |
| def squares(density=20, radius=200): | |
| t = Turtle() | |
| space = radius * 2 / density | |
| for x in range(-radius, radius, round(space)): | |
| y1 = -sqrt(radius ** 2 - x ** 2) | |
| y2 = -y1 | |
| t.penup() | |
| t.goto((x, y1)) | |
| t.pendown() | |
| t.goto((x, y2)) | |
| t.penup() | |
| t.goto((y1, x)) | |
| t.pendown() | |
| t.goto((y2, x)) | |
| t.export("circle") | |
| squares(density=40, radius=600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment