My Ray Tracing Adventure (Fall 2024)
I have been making a game (also its game engine) this summer. The game was 2 dimensional, so for some calculations inside the game I created a Vector class for 2d vectors. For this homework, I converted the Vector class to a 3d one. I defined other objects by Vector class. Each vertex is a vector. I defined a Object class which is (for now) a abstract base class for 2 real scene objects: triangle and sphere. There are many ways to define a 3d triangle, I thought when it came the time to write the class definition of it. My implementation has become as follows: A triangle class have 3 Vectors: one is the global position of one of its vertices. The other 2 are the relative positions of its remaining vertices (maybe you can call them edges ?). The Sphere class was straightforward: a Vector for global origin position and a float for radius. I decided to define a Ray class, and have the Object intersections with it as its methods. I decided to define a ray by 2 Vectors: a starting point and...