hi,

does anyone have or know were i can get some coding for a fractual curve any curve that is or may be a Dragon Curve.

thanks

Recommended Answers

All 7 Replies

google is your friend http://commons.wikimedia.org/wiki/File:Dragon_curve.png

Wow. I love that db replaced the text within that hyperlink with a smiley. I'm sorry this post isn't on topic but I just wanted to get that out there.

Hey, and the link still works!

EDIT:
kette = chain
laenge = length
zeichne = draw
* Courtesy Google Translate

thanks for the info do you know how i can paste the code in python and see it in action

thanks for the info do you know how i can paste the code in python and see it in action

Select the code from webpage -> Ctrl + C
Open your favorite code/text editor -> Ctrl + V
Save As.... <File_name>.py
Run!

For your own sanity's sake you should replace the tabs with spaces... also make sure you have the modules required for xturtle

anyone know any other fractual curves code apart from the dragon curve which is a bit more easy and simple something like Torn Square fractal

You can play with this:

# draw a dragon curve fractal using Tinter's turtle
# dense version using recursion
# modified from: http://www.rosettacode.org/wiki/Dragon_curve

from turtle import *

def dragon(step, length, zig=right, zag=left):
    if step <= 0:
        forward(length)
        return
    step -= 1
    length /= 1.41421
    zig(45)
    dragon(step, length, right, left)
    zag(90)
    dragon(step, length, left, right)
    zig(45)


# set to False to speed things up (default is True)
tracer(False)

# draw in this color
color('red')

# turtle by default starts at (x=0, y=0) center of display
# lift pen up to move to the left by 130 units and up 70 units
# then drop the pen down to start drawing
up()
goto(-130, 70)
down()

# experiment with step and length
step = 12
length = 300
dragon(step, length)

# gives some viewing time ...
import time
time.sleep(7)

sneekula u da man thank alot that make alot more sense than the wikipedia one

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.