Implementation of Fractal Binary Trees in python.
Introduction A fractal tree is known as a tree which can be created by recursively symmetrical branching.
The trunk of length 1 splits into two branches of length r, each making an angle q with the direction of the trunk. Both of these branches divides into two branches of length r*r, each making an angle q with the direction of its parent branch. Continuing in this way for infinitely many branching, the tree is the set of branches, together with their limit points, called branch tips.
So enough with the theory now let’s try to implementation in Python. To do so we require two python libraries pygame for GUI or graphical user interface and math which is a builtin library in python and will be used for mathematical tweakings.
To install pygame
pip install pygame
So how to proceed, its highly recommended that you know a bit about pygame and fractals.
First create a trunk and then start creating the branches for each trunk taking the size of the branches of the size equal to the 0.9*(length of the stem) and then again considering the branches as stem again and such repeating the process.
- Fractal using Spirograph in Python
- Snowflakes Fractal using Python
- Julia fractal in Python
- Mandelbrot Fractal Set visualization in Python
- Python | Plotting Fibonacci spiral fractal using Turtle
- Creating Butterfly themed Fractal in C++ Using Graphics
- Python | Convert list to Python array
- Reading Python File-Like Objects from C | Python
- Python | Index of Non-Zero elements in Python list
- Important differences between Python 2.x and Python 3.x with examples
- Python | Merge Python key values to list
- Python | Sort Python Dictionaries by Key or Value
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to Python Libraries
- Python | Add Logging to a Python Script
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.