File:Dragon curve.png

Original file(681 × 681 pixels, file size: 11 KB, MIME type: image/png)

Summary

Description

Spacefilling combination of four dragon curves

Created with Python and xturtle graphics module
Date 5. 11. 2006
Source Own work
Author Stefan Lew
Permission
(Reusing this file)
This image is public domain. You may use this image for any purpose, including commercial.

Source code

#
# Dragon curve
#

from xturtle import *

def fold(direction):
	if direction == 0:
		p.right(90)
	else:
		p.left(90)

def next(kette):
	kette.append(1)
	laenge = len(kette)
	for i in range(0, laenge-1):
		kette.append(kette[i])
	if kette[laenge-1+laenge/2] == 0:
		kette[laenge-1+laenge/2] = 1;
	else:
		kette[laenge-1+laenge/2] = 0;
	return kette

def zeichne(kette):
	p.tracer(100)
	p.hideturtle()
	for i in kette:
		p.forward(2)
		fold(i)
	p.forward(2)
	p.update()

def find_iteration(n):
	kette = [1]
	for i in range(1, n):
		kette = next(kette)
	return kette

def set_back():
	p.penup()
	p.goto(0,0)
	p.pendown()


it = 15

p = Pen()
zeichne(find_iteration(it))
set_back()
p.color('red')
zeichne(find_iteration(it))
set_back()
p.color('blue')
zeichne(find_iteration(it))
set_back()
p.color('green')
zeichne(find_iteration(it))
raw_input()

Licensing

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

image/png

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current23:49, 4 November 2006Thumbnail for version as of 23:49, 4 November 2006681 × 681 (11 KB)Lew~commonswiki{{Information |Description=Spacefilling combination of four dragon curves Created with Python and [http://www.rg16.asn-wien.ac.at/~python/xturtle/ xturtle] graphics module |Source=own work |Date=5. 11. 2006 |Author=Stefan Lew |Permission=This image is pu
No pages on the English Wikipedia use this file (pages on other projects are not listed).

Global file usage

The following other wikis use this file: