A collection of C projects exploring 3D math, matrix transformations, and SDL2 graphics.
This project renders a 3D wireframe cube using 1,200 points. It applies a complex rotation matrix (pitch, yaw, and roll) to every point in real-time.
🛠️ Installation & Setup
To fix SDL2/SDL.h missing errors, install the development headers:
sudo apt update && sudo apt install libsdl2-dev- Fedora:
sudo dnf install SDL2-devel - Arch:
sudo pacman -S sdl2
Because this project uses both SDL2 for graphics and math.h for rotation matrices, you must link both libraries:
cc -o cube cube.c -lm `sdl2-config --cflags --libs`⚠️ Linker Warning:
If you seeundefined reference to cosorDSO missing, ensure you have placed -lm at the end of your command. This tells the compiler to include the math library.
The cube rotates using a 3x3 rotation matrix for 3D space. It calculates the new position of each point using the Dot Product of the rotation matrix and the point's current vector:
- α (Alpha): Rotation around the Z-axis (Roll)
- β (Beta): Rotation around the Y-axis (Yaw)
- γ (Gamma): Rotation around the X-axis (Pitch)
- ✅ Setup Basic Rendering & SDL Window
- ✅ Implement 3D Point cloud
- ✅ Matrix Rotation (Euler Angles)
- 🚧 Perspective Projection (Coming Soon)
- 📅 Line Drawing/Wireframe (Planned)