Skip to main content

Running Fract’ol

Fract’ol supports two fractal types: Mandelbrot and Julia. Each has different command-line requirements.

Basic Usage

./fractol Mandelbrot
The fractal name is case-sensitive. Use Mandelbrot or Julia exactly as shown.

Launch Examples

1

Launch Mandelbrot Fractal

The Mandelbrot set is the simplest to launch, requiring only the fractal name:
./fractol Mandelbrot
This opens a 2000x1500 pixel window displaying the iconic Mandelbrot set with psychedelic color gradients.

What You'll See

The classic Mandelbrot set centered at origin with:
  • Resolution: 2000x1500 pixels
  • Initial zoom: 1.0x
  • Default iterations: 30
  • Color scheme: Lime to mint gradient
2

Launch Julia Fractal

Julia sets require two parameters: the real and imaginary parts of the complex constant c:
./fractol Julia -0.4 0.6
The two parameters represent the complex number c = real + imaginary*i used in the Julia set equation: z = z² + c
3

Experiment with Parameters

Try different values to discover unique Julia set variations:
# Interesting combinations to try:
./fractol Julia 0.0 0.8
./fractol Julia -0.162 1.04
./fractol Julia -0.54 0.54
./fractol Julia 0.355 0.355
Invalid parameters will result in an error message:
Please enter: 
  "./fractol Mandelbrot"
   or
  "./fractol Julia <value_1> <value_2>"

Interactive Controls

Once the fractal window opens, you can explore and manipulate the visualization in real-time.

Zoom Controls

Zoom In

Mouse Wheel Up or Scroll UpZooms in by 5% (multiplies zoom by 0.95)

Zoom Out

Mouse Wheel Down or Scroll DownZooms out by 5% (multiplies zoom by 1.05)
// From events.c:46-59
if (button == Button4)        // Mouse wheel up
{
    fractol->zoom *= 0.95;    // Zoom in
}
else if (button == Button5)   // Mouse wheel down
{
    fractol->zoom *= 1.05;    // Zoom out
}

Pan/Navigate

Move around the fractal using keyboard controls:
KeyAction
↑ UpPan up
↓ DownPan down
← LeftPan left
→ RightPan right
Each pan moves by 0.5 * zoom units, so panning speed adapts to your current zoom level.
// From events.c:30-37
if (keysym == XK_Left || keysym == XK_a)
    fractol->shift_x -= (0.5 * fractol->zoom);
else if (keysym == XK_Right || keysym == XK_d)
    fractol->shift_x += (0.5 * fractol->zoom);
else if (keysym == XK_Up || keysym == XK_w)
    fractol->shift_y += (0.5 * fractol->zoom);
else if (keysym == XK_Down || keysym == XK_s)
    fractol->shift_y -= (0.5 * fractol->zoom);

Iteration Control

Adjust the detail level by changing iteration count:

Increase Detail

+ (Plus Key)Increases iterations by 5 (more detail, slower render)

Decrease Detail

- (Minus Key)Decreases iterations by 5 (less detail, faster render)
Default iteration count is 30. Higher values reveal more detail at deep zoom levels but increase rendering time.
// From events.c:38-41
else if (keysym == XK_plus)
    fractol->iterations_definition += 5;
else if (keysym == XK_minus)
    fractol->iterations_definition -= 5;

Exit Program

Close the fractal viewer:
  • ESC Key: Exit the program
  • Window Close Button (X): Exit the program
// From events.c:28-29
if (keysym == XK_Escape)
    close_handler(fractol);

Exploration Workflow

1

Launch Your Fractal

Start with either Mandelbrot or Julia:
./fractol Mandelbrot
2

Find an Interesting Region

Use arrow keys or WASD to pan around and locate intricate areas.
3

Zoom In

Scroll up to zoom into the region. The fractal will re-render automatically after each zoom.
4

Increase Detail

If the zoomed region looks blocky, press + to increase iterations for more detail:
Iterations: 30 → 35 → 40 → 45...
5

Continue Exploring

Repeat the zoom and pan process to discover infinite complexity:
  • Mandelbrot set borders contain infinite detail
  • Julia sets vary dramatically based on the c parameter
  • Try zooming into “seahorse valley” or “elephant valley” regions

Understanding the Rendering

Window Dimensions

The fractal renders at a fixed resolution defined in the header file:
// From fractol.h:24-25
#define WIDTH   2000
#define HEIGHT  1500

Color Scheme

Pixels are colored based on iteration escape time:
  • White: Points inside the set (reached max iterations)
  • Gradient (Lime to Mint): Points outside the set, colored by escape speed
// From fractol_render.c:53-54
color = map(i, PSYCHEDELIC_LIME, PSYCHEDELIC_MINT,
            fractol->iterations_definition);
The color interpolates between:
  • PSYCHEDELIC_LIME (#00FF00)
  • PSYCHEDELIC_MINT (#98FF98)
based on how quickly the point escapes to infinity.

Fractal Mathematics

Both fractals iterate the equation z = z² + c:
  • Mandelbrot: c is the pixel coordinate, z starts at 0
  • Julia: c is the command-line parameter, z starts at the pixel coordinate
// From fractol_render.c:48-58
while (i < fractol->iterations_definition)
{
    z = sum_complex(sqare_complex(z), c);
    if ((z.x * z.x) + (z.y * z.y) > fractol->escape_value)
    {
        color = map(i, PSYCHEDELIC_LIME, PSYCHEDELIC_MINT,
                fractol->iterations_definition);
        my_pixel_put(x, y, &fractol->img, color);
        return;
    }
    i++;
}

Tips for Best Results

Performance

  • Lower iterations for faster exploration
  • Increase iterations only when zooming deep
  • Smaller zoom values render faster

Aesthetics

  • Try Julia parameters between -1 and 1
  • Zoom into boundary regions for detail
  • Experiment with iteration counts (30-100)

Exploration

  • Start wide, then zoom progressively
  • Pan slowly to find interesting regions
  • Save interesting Julia parameters

Technical

  • Default escape value: 4
  • Coordinate mapping: -2 to +2 (real), +2 to -2 (imaginary)
  • Window must support X11 events

Command Reference

Keyboard Controls Summary

KeyAction
ESCExit program
↑ / WPan up
↓ / SPan down
← / APan left
→ / DPan right
+Increase iterations (+5)
-Decrease iterations (-5)

Mouse Controls Summary

ActionEffect
Scroll UpZoom in (×0.95)
Scroll DownZoom out (×1.05)

Next Steps

Now that you know how to use Fract’ol, explore more advanced topics:

Build docs developers (and LLMs) love