File:Dragon curve.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 600 × 600 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 681 × 681 pixels.
Original file (681 × 681 pixels, file size: 11 KB, MIME type: image/png)
File information
Structured data
Captions
Summary
[edit]DescriptionDragon curve.png |
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
[edit]#
# 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
[edit]Public domainPublic domainfalsefalse |
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. |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 23:49, 4 November 2006 | 681 × 681 (11 KB) | Lew~commonswiki (talk | contribs) | {{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 |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
- Usage on hr.wikipedia.org
- Usage on pl.wikipedia.org
- Usage on sh.wikipedia.org
- Usage on sv.wikipedia.org
Structured data
Items portrayed in this file
depicts
image/png
10,873 byte
681 pixel
681 pixel
b8eb76c8728ed7f649cb9557d5bec2c8b8183562
Hidden categories: