fractol is an interactive fractal explorer built in C as part of the 42 curriculum. It renders the Mandelbrot set, Julia sets, and other fractals in real-time with infinite zoom capability.
The project teaches complex number mathematics, color theory, optimization techniques, and event-driven programming. Each pixel's color is determined by how quickly the iterative formula z = z² + c diverges, creating infinitely complex patterns from simple mathematics.
About the project
fractol is a 42 Berlin curriculum project that teaches complex number mathematics, iterative algorithms, and real-time graphics rendering. The core challenge is mapping the escape-time algorithm — z = z² + c — onto a pixel grid with enough precision to support deep zoom without floating-point breakdown.
Technical challenges
The original C implementation uses MiniLibX to render Mandelbrot and Julia sets with keyboard-driven zoom and color controls. Performance is the central constraint: rendering the full set at high resolution on every parameter change is slow without optimization. Smooth coloring beyond raw iteration counts, handling Julia set constants, and managing coordinate precision at extreme zoom levels all require careful numerical handling.
This browser demo reimplements the same mathematics with progressive row-chunk rendering via requestAnimationFrame, updating the canvas in batches to keep the UI responsive. State snapshotting aborts stale renders when parameters change mid-frame, preventing visual artifacts during rapid zoom interactions.
What this taught me
Beyond the mathematics, this project was an early lesson in the tension between algorithmic correctness and perceived performance. Users do not care about a theoretically optimal render if the UI freezes. Progressive rendering, frame budgeting, and abort-on-change patterns learned here show up again in data pipeline work — where batching and cancellation matter just as much as getting the math right.