Skip to content

A Python-based fractal generator using mathematical models and visualization libraries like Pygame.

License

Notifications You must be signed in to change notification settings

SitiSahrani/Fractal-Generator-Python

Repository files navigation

🖥️ Portfolio Project: Fractal Visualizations with Pygame

This project explores the fascinating world of fractals, demonstrating how simple mathematical rules can generate intricate and beautiful patterns. Built using Python and Pygame, this repository features three visually stunning fractal visualizations. These fractals showcase the power of recursion, mathematical beauty, and computational efficiency.

📌 Overview This project showcases the following fractals:

  • Sierpiński Gasket – A self-replicating triangular fractal generated using the Chaos Game.
  • Julia Set – A complex-plane fractal created by iterating over complex numbers.
  • Mandelbrot Set – A famous fractal that reveals infinite complexity through iterative calculations.

🛠 Technologies Used

  • Python (for mathematical computations and graphics rendering)
  • Pygame (for visualizing the fractals in an interactive environment)
  • NumPy (for optimized calculations)

📂 Mathematical Background & Algorithms Fractals are generated based on mathematical formulas and iterative processes:

  • Sierpiński Gasket uses midpoint displacement in a triangle.
  • Julia Set follows the recursive formula:
    $$z_{n+1} = z_n^2 + c$$
    where c is a complex constant.
  • Mandelbrot Set iterates the same equation, but with c representing each pixel's complex coordinate.

▶️ Running the Project

1️⃣ Installation

Ensure Python 3.13, Pygame, and NumPy are installed:

pip install pygame numpy

2️⃣ Running the Scripts

Execute each fractal visualization with:

python Sierpinski_Pygame.py
python JuliaSet_Pygame.py
python Mandelbrot_Pygame.py

📊 Fractal Analysis & Output

1️⃣ Sierpiński Gasket

A triangle-based fractal generated by selecting midpoints iteratively.

Controls:

  • Press any key to pause/resume.
  • Click (X) to exit.

🎨 Example Output: Sierpiński Gasket


2️⃣ Julia Set

A stunning fractal generated from complex number transformations.

🎨 Example Output: Julia Set


3️⃣ Mandelbrot Set

A world-famous fractal revealing infinite self-similarity.

🎨 Example Output: Mandelbrot Set


🎨 Customization & Further Exploration

Want to experiment with fractals? Try modifying:

  • Iteration depth (for finer details)
  • Color schemes (for visual appeal)
  • Complex constants (in Julia Set for different patterns)

📜 License

This project is licensed under the MIT License – feel free to use, modify, and share! If you use or modify this project, kindly credit the original repository.

📢 Author Note: This project is part of my portfolio, demonstrating my skills in Python and fractal visualizations.

🚀 Explore the beauty of fractals!

About

A Python-based fractal generator using mathematical models and visualization libraries like Pygame.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages