Multiplying Matrices

Multiplication is the tool you’ll use to perform transformations like scaling, rotation, and translation. It’s certainly possible to apply them one at a time, sequentially, but in practice you’ll often want to apply several transformations at once. Multiplying them together is how you make that happen, as you’ll see when you get to Chapter 4, Matrix Transformations.

So let’s talk about matrix multiplication. It takes two matrices and produces another matrix by multiplying their component elements together in a specific way. You’ll see how that works shortly, but start first by writing a test that describes what you expect to happen when you multiply two 4x4 matrices together. Don’t worry about 2x2 or 3x3 matrices here; ...

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.