How m-u-c-k-a/fractol works
Main Components
• User Events Handler – Modules that process user interactions such as on_destroy, on_mouse_hook, on_key_hook, and on_mousemove. This component captures inputs from the windowing system.
• Fractal Algorithms – The collection of fractal implementations (mandelbrot, julia, burning ship, tricorn, mandelbar/ “celtic_mandelbar”, mandelbox). These functions compute the fractal values based on the complex coordinate inputs.
• Engine (Core Logic) – The Fractol Engine that coordinates the overall logic including selecting and switching fractal types, resetting parameters, and initializing the system. Functions like change_fractal, set_fractal_type, reset_engine, and init_engine reside here.
• Utilities – A set of helper functions for error messages, string manipulations (e.g., ft_strlower), printing, and help displays.
• External Dependencies – External libraries such as libft (a custom C utilities library) and the MLX (MiniLibX) library used for window management and rendering.
Understand the Relationships and Data Flow
• Input Flow: User Events capture input from the graphical window (managed through MLX). These inputs are sent to the Engine.
• Engine Logic: The Engine interprets the event, decides when to change parameters, reset the state, or even swap fractals.
• Rendering Process: The Render module takes these computed values and uses MLX functions to plot them as pixels on the window.
• Utility Support: Throughout, utility functions provide logging, error handling, and other supportive tasks.