#!/usr/bin/python
import turtle
from sys import argv
from math import *
x = 500
y = 500
def turtle_draw_line(x1, y1, x2, y2, color=(0, 0, 0)):
turtle.color(color)
turtle.penup()
turtle.setx(x1)
turtle.sety(y1)
turtle.pendown()
turtle.goto(x2, y2)
def turtle_init(thickness, background):
turtle.speed = 0
turtle.bgcolor(background)
turtle.width(thickness)
def turtle_end():
input()
def getend(r, theta, x1, y1):
mx = r * cos(theta / (180/pi))
my = r * sin(theta / (180/pi))
return x1 + mx, y1 + my
svg_output_file = 0
def run_with_turtle(fractal):
draw_fractal(fractal, turtle_draw_line, turtle_init)
turtle_end()
def svg_draw_line(x1, y1, x2, y2, color=(0, 0, 0)):
x1 += x/2
x2 += x/2
y1 = -y1 + y/2
y2 = -y2 + y/2
line = '\n'%(x1, y1, x2, y2, str(tuple([int(c*255) for c in color])))
svg_output_file.write(line)
def svg_end():
svg_output_file.write("\n")
def svg_init(thickness, background):
# This should be provided by draw_fractal
header = "