Simple RayCasting (part1)

I wanted to understand how wolfenstein 3D produced its graphics after reading the wikipedia website I found out that it used a raycasting engine to create the 3D effects from a 2D map. So I decided to have a go at creating a very simple raycasting engine. For this project I used the simple direct media layer (SDL) to give me a straight forward way to draw to the screen under windows and dev-cpp as the c development environment.

Raycasting basically uses the properties of trigonometry to create a 3D world from a 2D map, the demo I ended up creating allows the user to spin round within a cube each wall having a different colour. This is quite a ruff raycasting engine the code is not optimised and due to rounding errors within the trigonometry calculations the walls edges are also quite ruff. Hopefully I will get time in future to improve the coding but for now here is my first shot at raycasting, and a screen shot of how it looks.