February 2019
Intermediate to advanced
292 pages
6h 55m
English
Each ray created by your ray tracer will have a starting point called the origin, and a vector called the direction which says where it points. Write the following test, showing how you create a ray and what its primary attributes should be:
| | Scenario: Creating and querying a ray |
| | Given origin ← point(1, 2, 3) |
| | And direction ← vector(4, 5, 6) |
| | When r ← ray(origin, direction) |
| | Then r.origin = origin |
| | And r.direction = direction |
Armed with a ray’s origin and direction, you can find points that lie any distance t along the ray. Why t? Blame the mathematicians! It stands for time, which only makes sense once you think of the ray’s direction vector as its speed. For example, if the ray moves one ...
Read now
Unlock full access