Skip to content

Instantly share code, notes, and snippets.

@adusak
Last active August 29, 2015 14:19
Show Gist options
  • Save adusak/e195f17f75352e8f2dd0 to your computer and use it in GitHub Desktop.
Save adusak/e195f17f75352e8f2dd0 to your computer and use it in GitHub Desktop.
Grid circle
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