Navigation Controls
Fract’ol provides intuitive keyboard and mouse controls for exploring fractals in real-time. All controls trigger an immediate re-render of the fractal.Keyboard Controls
The keyboard handler is implemented inevents.c:26:
Panning Controls
Arrow Keys
Move in any direction
- ← Left Arrow: Pan left
- → Right Arrow: Pan right
- ↑ Up Arrow: Pan up
- ↓ Down Arrow: Pan down
0.5 * zoom unitsWASD Keys
Alternative movement
- A: Pan left (same as ←)
- D: Pan right (same as →)
- W: Pan up (same as ↑)
- S: Pan down (same as ↓)
The panning distance is zoom-aware: when zoomed in, you pan less distance per keypress, giving you finer control over navigation.
Detail Controls
+ (Plus)
Increase detailAdds 5 iterations to
iterations_definitionReveals more detail at fractal boundaries but renders slower- (Minus)
Decrease detailRemoves 5 iterations from
iterations_definitionFaster rendering but less detail, useful for quick explorationThe default iteration count is 30. Deep zoom levels may require 100+ iterations to properly render fine details.
System Controls
ESC
Exit the programCleanly destroys the window, image, and MLX connection before exiting.
Mouse Controls
The mouse handler enables smooth zooming functionality:Scroll Up
Zoom In (Button4)Multiplies zoom by
0.95Decreases the visible area, magnifying the fractalScroll Down
Zoom Out (Button5)Multiplies zoom by
1.05Increases the visible area, showing more of the fractalThe zoom factor changes by 5% per scroll. Multiple rapid scrolls create smooth zoom animations. The zoom is centered on the current view, not the mouse position.
Complete Control Reference
Quick Reference Table
| Control | Keysym | Action | Effect |
|---|---|---|---|
| ← | XK_Left | Pan left | shift_x -= 0.5 * zoom |
| → | XK_Right | Pan right | shift_x += 0.5 * zoom |
| ↑ | XK_Up | Pan up | shift_y += 0.5 * zoom |
| ↓ | XK_Down | Pan down | shift_y -= 0.5 * zoom |
| A | XK_a | Pan left | Same as ← |
| D | XK_d | Pan right | Same as → |
| W | XK_w | Pan up | Same as ↑ |
| S | XK_s | Pan down | Same as ↓ |
| + | XK_plus | Add detail | iterations_definition += 5 |
| - | XK_minus | Remove detail | iterations_definition -= 5 |
| ESC | XK_Escape | Exit program | Cleanup and exit |
| Scroll Up | Button4 | Zoom in | zoom *= 0.95 |
| Scroll Down | Button5 | Zoom out | zoom *= 1.05 |
Event System Architecture
The controls are hooked into the MiniLibX event system during initialization:All event handlers receive the
t_fractol structure, allowing them to directly modify rendering parameters and trigger re-renders.Navigation Strategies
Exploring New Regions
Exploring New Regions
- Start zoomed out to see the overall structure
- Use keyboard panning to position interesting features in the center
- Scroll to zoom in gradually
- Increase iterations (+) as you zoom deeper
- Pan to nearby features to explore the area
Performance Optimization
Performance Optimization
- Decrease iterations (-) when navigating quickly
- Zoom out slightly if rendering is too slow
- Increase iterations only when examining details
- The 2000x1500 window size provides good balance
Precision Navigation
Precision Navigation
Deep Zoom Workflow
Deep Zoom Workflow
- Identify target region
- Center it using WASD/arrows
- Zoom in with multiple scroll ups
- Press + several times to add iterations (e.g., 50-100)
- Wait for render to complete
- Fine-tune position and zoom
Keysym Values
The controls use X11 keysym constants defined in<X11/keysym.h>:
These are standard X11 constants, ensuring compatibility across Linux systems using X Window System.
Real-Time Rendering
Every control action triggers an immediate re-render:- Parameters are modified (zoom, shift_x, shift_y, iterations)
fractol_render()iterates through all 2000×1500 pixels- Each pixel is computed using the escape-time algorithm
- The completed image is displayed to the window
Render time depends on iteration count and zoom level. At high iteration counts (100+), rendering may take several seconds.