Chapter 9Planes

You’ve been able to accomplish quite a bit so far using nothing but spheres as graphic primitives, which is pretty amazing. The world consists of a lot more than just spheres, though—even cleverly transformed spheres. In this chapter you’ll add a new graphics primitive—the plane—which will be perfect for modeling floors, walls, and backgrounds.

images/planes/plane-possibilities.png

The biggest initial hurdle will probably be refactoring your code to support different types of graphics primitives. We’ll begin the chapter by talking about how you might go about this refactoring, and identify the functionality that all primitives will have in common. Once the common ...

Get The Ray Tracer Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.