Slika:Dragon curve.png
Izvor: Wikipedija
| | Datoteka je dio Wikimedijinog spremnika gdje se nalazi i njen opis. |
[edit] Beschreibung
| Description |
Spacefilling combination of four dragon curves Created with Python and xturtle graphics module |
|---|---|
| Source |
own work |
| Date |
5. 11. 2006 |
| Author |
Stefan Lew |
| Permission |
This image is public domain. You may use this image for any purpose, including commercial. |
[edit] 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()
[edit] Licensing
| I, the author of this work, hereby release it into the public domain. This applies worldwide. In case this is not legally possible: Afrikaans | Alemannisch | Aragonés | العربية | Български | Català | Česky | Cymraeg | Dansk | Deutsch | Ελληνικά | English | Español | Esperanto | فارسی | Français | Galego | 한국어 | हिन्दी | Hrvatski | Ido | Bahasa Indonesia | Íslenska | Italiano | עברית | Latina | Lietuvių | Magyar | Bahasa Melayu | Nederlands | Norsk (bokmål) | Norsk (nynorsk) | 日本語 | Polski | Português | Ripoarish | Română | Русский | Slovenčina | Slovenščina | Српски | Svenska | ไทย | Türkçe | Українська | Tiếng Việt | Walon | 简体中文 | 繁體中文 | 粵語 | +/- |
Poveznice
Na ovu sliku vode poveznice sa sljedećih stranica:

