Adjugate matrix

The adjugate of any order matrix is the transpose of its cofactor matrix. The adjugate is sometimes referred to as adjoint:

Adjugate matrix

Getting ready

We already know how to take the cofactor of a matrix and how to transpose the matrix. Implementing the adjugate function is as easy as calling our existing cofactor and transpose functions.

How to do it…

Follow these steps to implement functions which return the adjugate matrix of two, three and four dimensional square matrices:

  1. Add the declaration for adjugate for all three matrices to matrices.h:
    mat2 Adjugate(const mat2& mat);
    mat3 Adjugate(const mat3& mat);
    mat4 Adjugate(const mat4& mat);
  2. Implement ...

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.