Skip to content

SitiSahrani/Fractal-Generator-Cpp

Repository files navigation

🖥️ Portfolio Project: Fractal Visualizations with C++

This project explores the fascinating world of fractals, demonstrating how simple mathematical rules can generate intricate and beautiful patterns. Built using C++ and graphics.h, this repository features multiple fractal visualizations, including Julia Sets, Mandelbrot Sets, and Sierpiński Gasket.

📌 Overview This project showcases the following fractals:

  • Sierpiński Gasket – A self-replicating triangular fractal generated using a midpoint algorithm.
  • 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

  • C++ (for mathematical computations and graphics rendering)
  • graphics.h (for visualizing the fractals)
  • conio.h (for console-based interactions)
  • cmath (for mathematical 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 you have a C++ compiler and graphics.h installed:

  1. Install a compiler like MinGW (for Windows) or g++ (for Linux/macOS).
  2. Install the necessary graphics library for your system.

2️⃣ Compiling and Running the Program

Windows (Turbo C++ or MinGW)

 g++ fractal.cpp -o fractal -lgraphics -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
 fractal.exe

Linux (Using SDL2 for graphics.h replacement)

 g++ fractal.cpp -o fractal -lSDL2
 ./fractal

📊 Fractal Analysis & Output

1️⃣ Sierpiński Gasket

A triangle-based fractal generated by selecting midpoints iteratively.

🎨 Example Output: Sierpiński Gasket 1 Sierpiński Gasket 2


2️⃣ Julia Set

A stunning fractal generated from complex number transformations.

🎨 Example Output: -Julia Set, with $$c=-0.7488+0.107421i$$ Julia Set, with $$c=-0.7488+0.107421i$$

-Julia Set, with $$c=-0.9+0.2i$$ Julia Set, with $$c=-0.9+0.2i$$


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 C++ and fractal visualizations.

🚀 Explore the beauty of fractals!

About

A C++ implementation of fractal generation using mathematical algorithms for visualization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages