FdF (Fil de Fer – “wireframe”) is a graphics project that renders a 2D isometric wireframe using MLX42 library. It reads a map (see the format below), parses the values and calculates the coordinates for pixels first primitively from above. Then, takes into account the given altitude and recalculates coordinates into a 3D-like isometric projection.
Each line = one row (y). Values separated by spaces. A value can be:
Z
Z,0xRRGGBB
Example:
0 0 0 1 2,0xFF0000
0 1 2 3 4,0x00FFAA
Each number represents a point in space: • The horizontal position corresponds to its abscissa. • The vertical position corresponds to its ordinate. • The value corresponds to its altitude.
In this implementation I applied the 3 x 3 rotation matrix that I found on Wikipedia:
https://en.wikipedia.org/wiki/Rotation_matrix
I took the third matrix since the we only rotate around z axis. Hence these formulas:
isometric_x = cos(45 * (PI / 180)) * x - sin(45 * (PI / 180)) * y;
isometric_y = sin(45 * (PI / 180)) * x + cos(45 * (PI / 180)) * y;
If we wanted perfectly straight or diagonal lines it wouldn't be an issue to just iterate through x and y in loops. Here, the diagonal line can have let's say width 10 and height 4 which would be a shallow line. Because pixels can only be integers (no float), before putting one the programme must decide whether it moves straight to the right (or left) or up (or down). That's where this guy helped me: https://youtu.be/RGB-wlatStc?si=RZXFxfKUcOPuE_mq
Two variants handle slopes:
- Shallow: |slope| < 1 → step in x, conditionally adjust y.
- Steep: |slope| ≥ 1 → step in y, conditionally adjust x.
ft_gradient(start_color, end_color, position, length) interpolates each RGB channel linearly:
channel = start + (end - start) * position / length
Thanks for reading. If you reached here, I am already fond of you.

