HW1: Ray-Object Intersections

CS 481 Homework, Dr. Lawlor

I'd like you to compute ray-object intersections for a "sliced sphere": start with a hollow sphere, and then remove slices from it.  For example, this code creates four slices per unit along the X axis:
if (fract(4.0*P.x)<0.5) { /* then P hit a slice */ }
If you don't hit the front of the sphere, check against the back of the sphere.  Keep in mind that the back of a sphere has surface normal "N=-normalize(P);", since the normal should face inwards. 

Your program should include:
Turn in a JPEG screenshot named "screenshot.jpg", and turn in your source code.    I'd like them via Blackboard by Tuesday, February 7 before midnight.

For example, here's my screenshot:
Nonlinear screen distortion