CSC 473 - Final Project

For my final project for CSC473, I enchanced my Raytracer to take Constructive Solid Geometry operators for my objects.

The three operators I supported were: union, intersection, and difference. The fourth one, merge, is nearly idenitical to union, so I decided not to bother with it. Most of the code behind getting CSG operators to work, was understanding the collisions as "t" intervals, and then doing the operations over the intervals, rather than doing loagical comparsions of the collisions. For example, intersection is done by an intersection of the interval, rather than simply checking if the ray collides with both the right and left object.

Also, it's important to note that I use a slightly different format then Povray's format. In order to support the additional nested objects, I would've needed to rewrite the entire parser from scratch, as my parser did not nicely support it. So instead, I created a CSG operator "object" for each operator, which uses the last two objects made, to combine them into one object. It only includes two, because most CSG objects are made from a binary tree structure, rather than a list of objects.

Images:
Difference Union
Intersection Intersection

References:
Chapter from Peter Shirley's book. Pg 221.