As part of the 42 Network curriculum, I recently completed the Cub3D project—an exciting venture into the world of 3D graphics programming using ray-casting techniques. This project challenged us to create a 3D maze-like environment from a 2D map, similar to classic games like Wolfenstein 3D. Through this experience, I gained valuable insights into graphics programming, trigonometry application, and efficient rendering techniques.
https://youtu.be/AYjC75kCCzk?si=AOTx9LvIn1aFJg6C
Our implementation of Cub3D includes several core features:
At the core of Cub3D lies some fascinating mathematics, particularly trigonometry. Here's a brief overview of the key concepts we applied:
Radians are the angular unit of choice in mathematics and physics. One radian is the angle subtended at the center of a circle by an arc equal in length to the radius. A full circle contains 2π radians (approximately 6.28318 radians).
These fundamental trigonometric functions relate the angles of a triangle to the lengths of its sides: