February 2019
Intermediate to advanced
292 pages
6h 55m
English
Recall that the normal is the vector that points outward perpendicularly from a surface. Your ray tracer uses it to compute a variety of effects, including shading, reflection, and refraction. Fortunately, the algorithm for finding the normal on a cube is elegant and short—two delightful attributes!
Let’s jump right into the test.
Show that the local_normal_at function correctly computes the normal at various points on a cube.
Now, each face of a cube is a plane with its own normal. This normal will be the same at every point on the corresponding face. The following test demonstrates this by finding the normal at various points on a cube.
| | Scenario Outline: The ... |
Read now
Unlock full access