Assignment 1 – Planes and Cylinders
In this assignment, you will implement ray intersections with planes and cylinders and compute surface normals at the intersection points. The framework code provided this weekisidenticaltolastweek’s,except“todo”commentshavebeeninsertedinPlane.cpp and Cylinder.cpp toindicatewhereyouneedtoaddyourimplementations. Ifyoualready set up a GitHub repository last week to collaborate with your fellow group members, you can copy these TODO comments over to your repository (or just note where your implementation needs to go and get started). In the expected_results directory, we provide the images you should expect your ﬁnishedcodetoproduceforasubsetoftheprovidedscenes. Onesuchresultisshownin Figure1. Theframeworkisconﬁguredtovisualizethesurfacenormalsinfalsecolor(the normal XZY components in [−1,1] are mapped linearly to RGB values in [0,1]).
Notes on Implementing Cylinder Intersections
You are asked to compute the intersection with an open cylinder (i.e. without end caps). The approach we recommend you take is to ﬁrst determine where the ray intersects a versionofthecylinderthatextendsinﬁnitelyineachdirection(asif height = ∞). Then, from this list of intersection candidates, discard those that fall outside the cylinder’s actual extent. Finally, choose the ﬁrst remaining intersection that appears in front of the viewer. Hint: you may ﬁnd it helpful to read over Sphere::intersect in Sphere.cpp.
Derivetheformulasyouusetosolveforthecylinderintersectionsandcomputenormals. Forfullcredit,thederivationmustbecomplete(endingwiththeformulasyouimplement in Cylinder.cpp) and possible to follow.
Each part of this assignment is weighted as follows:
• Ray-plane intersection: 20% • Ray-cylinder intersection + normal derivations (theory exercise): 25% • Ray-cylinder intersection implementation: 40% • Cylinder normal implementation: 15%
What to hand in
A.zipcompressedﬁlerenamedto ExerciseN-GroupI.zip where N isthenumberof the current exercise sheet and I is the number of your group. It should contain only: • The ﬁles you changed (in this case, Plane.cpp and Sphere.cpp) and the requested program output. It is your responsibility to ensure that all ﬁles that you have changed are in the zip. • A readme.txt ﬁle containing a description on how you solved each exercise and theencounteredproblems. Indicatewhatfractionofthetotalworkloadeachproject member contributed. • Otherﬁlesthatarerequiredbyyourreadme.txtﬁle. Forexample,ifyoumention some screenshot images in readme.txt, these images need to be submitted too. • A TheoryExercise.pdf containing your cylinder-ray intersection derivations.