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.
- Julia fractal in Python
- Fractal using Spirograph in Python
- Snowflakes Fractal using Python
- Mandelbrot Fractal Set visualization in Python
- Python | Plotting Fibonacci spiral fractal using Turtle
- Python | Merge Python key values to list
- Python | Convert list to Python array
- Python | Index of Non-Zero elements in Python list
- Reading Python File-Like Objects from C | Python
- Important differences between Python 2.x and Python 3.x with examples
- Python | Add Logging to a Python Script
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to Python Libraries
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Visualizing O(n) using Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.