Modify your C++ ray tracing program to include the ability to render scenes that include triangles. You should create a triangle class and an abstract geometry class that is a super class of both sphere and triangle.
The geometry class should have an abstract function for testing for intersection with a ray. Both the sphere and triangle class should override this function. The scene class should be modified to store all triangles and spheres in a list of geometry objects. The ray trace function in the scene class should be largely unchanged.
The triangle class intersection function should use barycentric coordinates to determine both if a ray intersects with a triangle and the parametric distance to the intersection. The intersection location can be computed by using the parametric distance and the parametric equation for a ray. The normal of the triangle can be computed with the cross product of two vectors in the triangle's plane.
The scene file specifies a triangle to be rendered with a line that begins with "triangle" and looks like:
triangle ax ay az bx by bz cx cy cz
Where a, b, and c are the three vertices, in counter-clockwise order, of the triangle.
Tar your code in a file that contains your name and submit it on the course Inquire site.