Making a 3D Checker Pattern
A two-dimensional checker pattern is a repeating pattern of squares, where two squares of the same color are never adjacent, like this:
What’s cool is that this idea can extend to three dimensions, too, like this:
You get a pattern of alternating cubes, where two cubes of the same color are never adjacent. This three-dimensional checker pattern is the one you’ll implement here.
Go ahead and write the following tests for these 3D checkers, showing that the pattern does indeed repeat in all three dimensions.
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.