Scaling

The scale of a matrix is stored in the main diagonal of the matrix. The scale is stored as a vec3. Each element of the vec3 represents the scale on the corresponding axis. Row and Column major matrices store scale information in the same elements:

Scaling

The interesting thing with storing scale inside a matrix is that it shares some of the same elements as the rotation part of the matrix. Because of this, extracting the scale of a matrix may not always yield the numbers you would expect.

Getting ready

We're going to implement three functions. One function will retrieve the scale stored inside a matrix. The other two will return a new matrix, containing ...

Get Game Physics Cookbook 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.