Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

kibotrel/42-Fractol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

julia_0

42-Fractol

This project's goal is to make a fractal visualizer.

Install

Only works on 42-Paris Dumps at the moment but should be portable on any macOS X. This project countains several submodules you must initialize them beforehand :

⚠️ As of June, 3rd 2022, this program does not work anymore due to a lot of deprecations and won't be updated as it's a simple school project.

$> git clone --recurse-submodules -j3 https://github.com/kibotrel/42-Fractol
$> brew install pidof && cd 42-Fractol && make

Usage

Run the program

Once the program is compiled, run it with the following command line :

$> ./fractol 'Desired Fractal'

To get more informations on how the program works and how you can interact with it type :

$> ./fractol

To set everything up before running the visualizer with a graphic interface do :

$> ./fractol menu

Fractal list

Every fractal bellow are handled by the program.

Name Type Multithread
Mandelbrot Complex ✔️
Julia Complex ✔️
Burning Ship Complex ✔️
Burning Julia Complex ✔️
Sierpinski triangle Space filling curve ✖️
Van Koch's snowfake Auto-similar ✖️
Barnsley's fern Random generation ✖️
Flower (Original) Space filling and auto-similar ✖️

Controls

Keyboard :

  • W / A / S / D Shift the displayed fractal by a fixed length in the desired direction
  • 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 Change the displayed fractal in the visualizer
  • M Update the used coloring process between Gradient mode and Areas mode
  • V / B / N Modify the color used in Gradient mode
  • Z / X / C Modify the color used in Areas mode
  • Page_Up / Page_Down Update the amount of details in the displayed fractal
  • P Trigger Psychedelic mode
  • J / K / L Modify the audiofile used in Psychedelic mode
  • ~ Toggle the variation of Julia and Burning Julia using mouse cursor position
  • R Reset everything to the default point of view
  • ESC Quit the visualizer

Mouse:

  • Mouse Wheel Update the zoom level depending on the scroll direction
  • Cursor Update preset complex in both Julia and Burning Julia fractals

Error management

Each following error is handled by the program leading to a complete memory free and program exit :

  • Invalid fractal name (ERROR-CODE 1)
  • Failed memory allocation (ERROR-CODE 2)
  • Failed to fork the process (ERROR-CODE 3)
  • Failed to create a thread (ERROR-CODE 4)
  • Failed to play an audio file (ERROR-CODE 5)
  • Audio file unavailable (ERROR-CODE 6)

Whenever one of these error occurs, the correct error message is displayed on the standard output and the whole program return an error code that you can retrieve by running :

$> echo $?

Screenshots

mandelbrot_0 julia_1 julia_3 burning_ship burning_julia_0 burning_julia_1 sierpinski koch barnsley flower menu_0 menu_11 menu_2