Skip to content

Coding the Dragon Curve fractal in using the Turtle module in Python

Notifications You must be signed in to change notification settings

Aditya-Ramachandran/Dragon_Curve_Fractal

Repository files navigation

forthebadge made-with-python ForTheBadge built-with-love

Dragon Curve Fractal

Fractals have always fascinated me, no matter which shape or size they come in, no matter what patterns they resemble within them. For the ones who are still in the dark, fractals are just a self replication of a particular pattern.

There are many fractals that are found in nature. One such fractal curve is known as Heighway Dragon, or simply the Dragon Curve. Because this is a fractal, hence it requires an IFS (Iterated Function System). In simple words, we make a simple pattern, put it into a recursive function, before running a loop and calling the function over and over again until our objective is accomplished. This is the route that I took. Of course this can be done without recursion(using loops) which I will put as the other solution.

I used Python with Turtle package for both the methods, which simplifies my work down by a ton. Had I done it in C++, I would have had to write functions, and classes for drawing, painting, iterating and putting everything into a window. However, I do have plans for that, and if I can come up with a nice and easy working C++ code, I will put it up here. For now, let’s get cracking with Python.

P.S. The logic behind the code can be found in the documentation folder of this repository.

Results

Dragon Curve Fractal using Recursion

Dragon Curve Fractal (olive green colour)

Dragon Curve Fractal (green)

Dragon Curve Fractal using Loops

Dragon Curve Fractal (loops)

Languages used :

  • Python
    • Turtle Module

About

Coding the Dragon Curve fractal in using the Turtle module in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages