The goal of this program is to generate images using the Raytracing protocol. Those computer-generated images will each represent a scene, as seen from a specific angle and position, defined by simple geometric objects, and each with its own lighting system.
A scene in format *.rt
-lm man man 3 math
)Rays are an abstraction with 2 vectors, that represent an origin point and a direction. A direction is a normalized vector, a vector that has a lenght of 1. They also have a struct for color, that has 3 integers, one for each color channel.
Hits are another abstraction with 2 vectors, a float t, an object pointer and a color. The vectors are the point in which the ray collided with our object, and the normal of the surface it hit. The most important thing here is the t value, that represents the depth of the hit object, has any point in a line can be represented like *P = origin + t direction**. It also stores a reference to the object that it hit, being NULL if it didn't hit anything.