Skip to content

Instantly share code, notes, and snippets.

@adusak
Last active August 29, 2015 14:19
Show Gist options
  • Save adusak/c8bc98a77a0fa01231d9 to your computer and use it in GitHub Desktop.
Save adusak/c8bc98a77a0fa01231d9 to your computer and use it in GitHub Desktop.
Diamond
from math import pi
from python.common.Turtle import Turtle
def diamond(radius=200):
density = round(radius / 100 * 12)
t = Turtle()
length = (pi * radius) / density
angle = (density - 2) * 180. / density
k = density + 6
for _ in range(k):
for i in range(density):
t.forward(length)
t.right(180 - angle)
t.right(360. / k)
t.export("diamond")
diamond(600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment