CPSC310A Assignment 13 - Bounding Boxes

Due Monday March 26

Details

Modify your C++ ray tracing program to include axis aligned bounding boxes to speed up the rendering of obj models. A bounding box can speed up render times because it is possible to avoid intersection tests with every triangle in an obj model if a ray does not intersect with the model's bounding box.

Create a bounding box class. The class should have two points, min and max, representing the minimum and maximum xyz values of all vertices withing the bounds of the box. The bounding box constructor should initialize the two points to positive infinity and negative infinity. The model class should be modified to include a bounding box as a member value. Whenever a triangle vertex is added to a model the bounding should be expanded to encompass the new vertex, if needed. The bounding box class should also have an intersect method that returns the parametric distance of the closest intersection of a ray with the bounding box. Finally, the intersection method of the model class should be modified to first test if the ray intersects with the model's bounding box. If it does not intersect, then the function can return false without testing for intersection with any of the model's triangles. If it does intersect, then the function can return the result of testing for an intersection with all triangles.

Submission

Tar your code in a file that contains your name and submit it on the course Inquire site.