For todays Maths and Programming lesson, we took a look at Matrix Equations. Addition, Subtraction and Transpose in particular. Addition and Subtraction did pop up on the mini mock and was one of the questions I got correct without even knowing what a Matrix is or how the equations work, as it turns out, these are simple equations as opposed to last weeks task.
For Addition of Matrices we simply take each number in the position its in from both brackets and add A to B to get a result of C.
For Subtraction of Matrices we simply take each number in the position its in from both brackets and subtract A from B to get a result of C.
For Transpose of Matrices we make the rows into columns, so row 1 becomes column 1, row 2 becomes column 2 and so forth.
It is worth noting that for these Matrix Equations, A and B must be the same size, you can’t add a 3×3 matrix to a 4×4 Matrix because Matrix B has more values than Matrix A.
We then started on Matrix Multiplication again for further practice. This time, multiplying a 3×3 into a 2×2. I found this one easier although I don’t exactly know why.
Equation 2 featured a 3×3 into a 3×3.
Finally Equation 3 and 4 were Scalar Matrix equations, these are easy as you multiply the number in the matrix by the scalar on the outside.
Where are Matrices used in Video Games?
Matrices are used in video games for alot of movement and animation, if we’re in a game engine and we are modifying a transform of an object, the engine uses a matrix to calculate the transform. The same can be said from a player point of view, as they move the character around in the game, the game is calculating the matrix in the background in order to move that player. Another example would be for Field of View. Just adjusting a slider in a game isn’t doing anything without the proper mathematics behind it, when you adjust that slider, the computer is computing matrices programmed into the game in order to make sure the camera only changes FOV and nothing else.