Git Product home page Git Product logo

42_fractol's Introduction

Fract'ol

A CPU-based fractal renderer for Hive. Written in C on top of MiniLibX, the school's own X11 library. The goal of this project was to have a graphical program displaying different complex sets, such as Mandelbrot and Julia.

Introduction

We represent the screen as a 2D complex plane, where the X-axis represents real values and Y-axis represents imaginary values. For each point (pixel), we can apply a repeating complex function, which will move the point on the complex plane. The function is exponential so successive iterations will have greater effect if the initial point is shifted further from the center. After enough iterations, some points will escape ever further, reaching towards infinity, whereas some points will stay within a limited area forever. These latter points represent the complex set, such as the Mandelbrot Set.

We render each pixel a different color based on how many iterations it took for it to escape. We have an arbitrary MAX_DEPTH to prevent the program from freezing during calculation. We use this value for any point inside the set. In practise this gives us mesmerizing self-similar shapes you can zoom into "infinitely" (though computer limitations get in the way).

Mandelbrot Set

Features

  • Mandelbrot, Julia, Tricorn, Burning Ship
  • Pan
  • Zoom
  • Adjusting the constant value of the Julia Set with cursor
  • Periodicity
  • BSP scan optimization (Mariani-Silver)
  • Debug view (visualizes rectangle scan-depths per pixel)

Multithreading and adaptive depth were also planned, but ultimately scrapped.

Install

Note: currently only supports MacOS! Prerequisites are clang and make.

cd into the root of the repository and run make. For convenience there are also:

  • make W for stricter rules
  • make O for speed optimization (-O3)
  • make D for a debug build

42_fractol's People

Contributors

nootech avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.