 Let us do homogeneous transformation matrices one of the reasons why I want to jump to this now is I want to combine rotation and translation because I need to use both of those operations to be able to place a rigid body anywhere I like in the world right because these remember these are the movable parts of our model the movable models. So, one way to achieve that is to do rotate rotation followed by translate. So, in other words I get my transform point x prime, y prime, z prime by multiplying out this rotation matrix R which I will just again not write all the entries and I will just put points here. So, that is a valid rotation matrix and then x, y, z is my 3D point that I would like to rotate ok. We agree that that is just simple rotation that we have been doing using the matrix and now I add to it some translation that I want to do I was using this notation last time I use x t, y t and z t for translation. So, if I go ahead and do this I should be able to generate any position and orientation for the rigid body how many degrees of freedom do I have here 6 correct. So, I have 3 different parameters here I can apply for translation and then I have 3 independent parameters I can apply in here after we satisfy all those constraints I gave last time for a rotation right. So, that gives a full 6 degrees of freedom again we could do this part of the computation we are using quaternions, but I am doing all matrices today at this point because of some of the particular transformations I will be getting into. There are interesting questions then about when to convert to quaternions and why at different various times. So, one thing to note is that the rotation part is a standard linear transformation, but this addition part comes outside of that because I am not multiplying a matrix here in the front right. So, I am not multiplying and adding matrices I somehow I do not have a simple equation of the form y equals a x I have added some extra term to it. So, one simple trick that people like to do is just extend the matrix by one dimension add another row add another column and then you can get this expression into a form that looks like this or there is just a single matrix. So, it is just a kind of let us say mathematical or algebraic hack and we end up getting something that is algebraic equivalent. So, let me just you know there is no real magic to it other than just recognize that it algebraically computes the same thing. There are some deeper interpretations having to do with projective geometry, but I do not need to go into that for this part. So, we make a 4 by 4 matrix that is algebraically equivalent when applied to a point. So, what I do is I take my x y z point over here when I just applied the rotation and translation in the standard way my point is just x y z over here I am going to extend the vector by one dimension and just put a 1 at the end. So, I am going to have the point look like this I will put a 1 at the end, but I will just know that this 1 is something extra that I am using to perform an algebraic trick. So, I am not really increasing the dimension of the point itself and then I am going to calculate some x prime y prime z prime and the results going to be 1 for that and now have a 4 by 4 matrix and the upper the upper left 3 by 3 component is just going to be the rotation matrix. So, this will be the rotation matrix R just copy it exactly from here and place it in and then I am going to take my translation parts and put them down here x t y t z t and the bottom row is going to look like the piece of the identity matrix. So, it will be 0 0 0 1 and then I will apply this matrix to my new 4 dimensional vector x y z 1. So, I go ahead and perform this multiplication now do we believe that we get the same result as we would from performing this multiplication right should not take too much to see the algebra of that. For example, if I just look at the calculation of x prime I get I get the upper row of the rotation matrix the first row of the rotation matrix applied to this column x y z here right. So, that gives me exactly the rotation part and then because I am carrying this 1 along here right I get because I am carrying this 1 here this 1 will multiply with this x t and just add it on right when I take this inner product between this 4 dimensional row and this 4 dimensional column I add on this x t that is exactly what I get over here right I am just adding on this x t for the translation. So, it is just a very simple hack that converts it into what is called homogeneous form. So, this is a homogeneous linear transformation and if by the way you want to add some extra part to it where there is an offset vector then this is called an affine transformation. It has very different properties and sometimes it is difficult to work with and you know algebraically a bit different. So, if you want to start chaining matrices together and have there be translations and rotations happening all the time then you do not have to switch operations you do not have to sometimes add on a vector sometimes multiply biometrics matrix. If you use homogeneous transformation matrices then you are always just multiplying matrices to achieve both rotations and translations. So, that makes it very nice people who do who work in computer graphics who want to code algorithms very efficiently in say GPUs would like to use the same piece of code or the same circuitry let us say over and over again. So, it is another motivation for putting everything into one standard form and just performing the same algebra every time. I have an interesting question for you now what is the inverse of this right. So, this is a homogeneous transformation matrix this 4 by 4 that performs rotation followed by translation. Well, before I ask about the inverse completely though before you answer that we should also understand what is the axis of rotation here right. So, if I translate first and then rotate is that the same as rotating and then translating right. So, if I translate first then I have effectively moved the axis of rotation. So, you could do that you could consistently go and define things that way we are going to do it in the easier to interpret way which is first apply the rotation. So, that we when we think about the axis angle representation we are rotating exactly about that axis and the axis angle representation. So, you grab the book here. So, if we if this were the origin you first apply the rotation and then translate it somewhere. If you were first to translate it somewhere then the rotation would be offset by quite a bit right depending on how large this displacement was that was induced by the translation. So, just something to pay attention to alright. So, these operations do not commute. So, if I take the inverse of this I need to pay attention to that. So, just something to warn you about alright. So, what is a T inverse and I have not written exactly what T is T is this 4 by 4 matrix here. So, I will say T is the 4 by 4 matrix. So, this part here this is matrix T. So, what is T inverse let me write a candidate for it. So, is T inverse equal to well why do not I just invert the rotation matrix what is the inverse of a rotation matrix just a transpose right. So, this only happens for what are called orthogonal matrices and orthogonal matrices are also have might you might want to call them orthonormal matrices because the the columns are have been normalized as well. So, not only are they orthogonal columns, but the links are normalized as well the the magnitude of the column vectors. And so, if I do that I could just maybe let us say take the 3 by 3 part here and I will just put r transpose in there because r transpose equals r inverse that does not work for general matrices, but it works here. So, we can go ahead and do that and now let us see why do not I just negate the translation. So, I could that is the inverse translation right if I if I move forward 5 meters the inverse of that is moving backwards 5 meters. So, why do not I just negate that. So, I can go minus X T minus Y T minus Z T and then I complete the rest of this matrix 0 0 0 1 how is that is that the inverse why not ok very good very good. So, the operations in the wrong order here. So, if you apply this matrix it is going to first unrotate and then untranslate right or first inverse rotate if you like and then inverse translate that seems fine except for that point that I made a little bit earlier when you have non commutative algebra you have to swap the order of operations when you take an inverse right you have to invert the order of operations. So, this is not going to work. So, the answer is no for that. So, let us write what the inverse actually is it is very helpful to observe these kinds of things when you are when you are writing code when you are doing development for these systems. I found it very helpful myself when doing development at Oculus just being very quickly able to find inverses change order of operations fix different kinds of bugs that happen very often you can get things working most of the time and then doing something catastrophically bad like maybe the yaw and the pitch will be aligned correctly and then the roll is backwards for some reason a lot of things happening like this and these are the kinds of tricks I think that are that are helpful the kind of insights let us say that are that are helpful that can save you a lot of time and trouble. So, if we go T inverse well the first thing I would like to do is undo the translation right because that was the last thing applied. So, to undo the translation I will put it over here I will make a matrix that undoes the translation if I want to make a perfect matrix that undoes the translation what should go inside of here the identity rotation which also just looks like the rest of an identity matrix. So, so that just undoes the translation that gets applied first, but remember that I am going from right to left that is why I made a big deal out of that as well. So, so when from right to left that gets applied first and then we come over here and in this case we undo the rotation. So, I have my r transpose there and then I fix the rest of this matrix here I had better not do any translations here now this is a pure rotation. So, I just put zeros and I complete the bottom in the same way always for these I do not need to multiply that out and simplify it you can go ahead and do that there is not you know this is a fairly generic matrix here anyway. So, I like to keep it in that form. So, once again to summarize T is rotation then translation when applied to a point and T inverse is inverse translation then inverse rotation ok questions about that.