Welcome back everyone. Today, we're going to continue on with our lecture series based upon the textbook linear algebra done openly, and we're in section 4.4 today, and we're going to talk about affine transformations. Like always, I will be your professor, Dr. Andrew Misaline at Southern Utah University. So we've talked in the past about linear transformations. Those transformations preserve vector addition and scalar multiplication. Today, we're going to talk about a generalization of linear transformation known as an affine transformation. Before we do that, I want to make a connection to the inner products we've been talked about in the previous three lectures with angles and geometry. We're going to talk about what the so-called law of cosines in the context of vector algebra, vector geometry. So whenever you have two vectors, let's say u and y here, there's always associated to these vectors a triangle, and we've seen this before. Let's take the vector u and let's take the vector y, and these are vectors which we're going to place the arrows tail to tail. So once you have these two vectors, we can actually form a triangle by taking the heads of the two vectors and connecting them. The one pointing from y to u would give us the vector u minus y. We always get this triangle right here, and so I'm interested in the angle formed between the two vectors. We'll call that the measure of that angle theta. Now in a standard trigonometry class, one often talks about the law of cosines, which could be thought of as generalization of the Pythagorean theorem. So if we have an oblique triangle, one where the angles are not necessarily right angles here, we get something like the Pythagorean theorem where if we take this side, u minus v, that is this side right here, that's opposite the angle, u minus v, the length of this side squared will equal the length of this side squared, the length of this side squared, but then we have to subtract from it two times the length of u times the length of y times cosine of theta there. And so there's this correcting factor we have to play. Now, of course, if our angle is a right angle, notice that if theta equals 90 degrees, then cosine of 90 is equal to zero. And so if you have a right triangle, cosine of 90 is zero, it just cancels off that correcting factor. And so the law of cosines degenerates to the usual Pythagorean equation. Now, if you remember the proof we saw earlier of the Pythagorean theorem in the context of vector spaces, there's this part that creeped up inside that proof. Well, I should say this part right here was creeping up in that proof. But if we were to carry through a similar argument, you can actually show that these two things are equal to each other, that u dot y is equal to the length of u times the length of y times cosine of theta. And so this is the correcting factor that comes from the parallelogram rule. And if we try to make that connection to right angles right here, if cosine is equal to theta, then well, this right here would equal zero. And so the right hand side would equal zero, which would enforce that the inner product u dot y would equal zero as well. That is to say u is perpendicular to y. So this idea of orthogonality of vectors is equivalent to the perpendicular angles you might know from a previous geometry class. And so this really is a generalization of the law of cosines one might have seen previously. And so also this equation right here can help us compute angles between vectors because if we solve for cosine theta on the right hand side, you'll get that cosine theta equals u dot y over the length of u times the length of y. And if you take our cosine, you can actually calculate the angle between vectors. So I want to do that in this two-dimensional example. Take the vector u to be six and negative one, take the other vector to be one and four, and these will live inside of r two. So by the previous formula, theta, the angle between the two vectors will be arc cosine of u dot v over the length of u times the length of v, v in this case. And if we calculate these things, the dot product of these vectors, you're going to get six minus four on top. If we calculate the lengths of the vectors, you get the square root of 36 plus one for u and you get the square root of one plus 16 for v. And so simplifying this a little bit, you get arc cosine of two over the square root of 37 times the square root of 17, which those aren't perfect squares, so we can't simplify them anymore. We probably want to use a calculator to help us simplify this expression right here. And so using just your usual scientific calculator, I'm going to have mine in degree mode. And so this would give us as approximately 85.43 degrees. Your answer would look a little bit different because it's in radians. Cosine inverse will always output an angle, but it should accept a ratio that's between negative one and one. So these two vectors are almost a right angle, about five degrees off. And that simple calculation can give us the angle between any two vectors.


Hi, I'm Amy Goodman, host of Democracy Now!, here to ask you to support Portland Media Center, PMC, the new name for Greater Portland's community television network. When you watch Democracy Now!, you know that now, more than ever, we need our independent community media in order to provide access for everyone, to straightforward, uncensored national and global news not available through the corporate media. Portland Media Center not only offers programming, like Democracy Now!, but also training and video production, so you can share your voice, ideas and information with your community. Become media-literate. Keep the free flow of important information and ideas going in your community. Watch Democracy Now! And support Portland Media Center, PMC, today.


Oh, the note is cool, but you want it real. Okay, I'll give you real.  Just remember, if your computer crashes, it's not my fault. You asked for it. Alright, let's make him real. Start with the brick texture. Make color one light orange, make color two dark brown. Change the mortar to gray. Now, to make sure the mortar isn't perfectly straight, get a Musgrave with scale set to 13.8, detail to 16, dimension to 0.1, and lack of norty to 1.5. Now, add a noise texture and set scale to 73.3, and detail to 16. Connect them with a mixed shader and set fact to 0.907. And if you drag that into color rim and drag that into mortar smooth, you can control the outlines with this point. Now, let's give the bricks a layer of shading with Musgrave and scale set to 22.2, detail to 16, dimension to 0.9, and lack of norty to 1.3. Drag it into a mixed shader with fact set to 0.883, and drag that into a multiply shader with fact set to 1. Drag the mix into color one and the bricks into color two. Now we need to add the wear and tear. The first layer just requires Musgrave with scale set to 13.8, detail to 16, dimension to 0.3, and lack of norty to 1.3. Drag that into the distortion of a noise texture with scale set to 4.2. And again, let's add some control with the color ramp. Drag black to 0.471 and turn the white node into a dark gray. Alright, time for some crack. Grab a noise texture and set scale to 5.7 and detail to 16. And drag it into color ramp.  Now duplicate and set scale to 4.5.  Now mix them together and multiply with fact set to 1. And control it all with the color ramp. White at 0.216, black at 0.616, and white at 1. Awesome! Now to control it, click the noise node and press control T. From here on, scale controls how often the cracks occur. Now I want them to squash vertically, so I'm gonna set X to 6.8. Okay, so here we have our bricks, wear and tear, and cracks. Time to put them together. Let's mix wear and tear with the cracks with the multiply node and fact set to 1. Then mix that together with the bricks using another multiply node and fact set to 1. Let's clean it up with the color ramp and set white to 0.083. Okay, and from here, you guys know the drill. Drag it into a bump and set strength to about 0.633. Also, drag it into roughness, shift A, S, invert, and drag it over to connection. And for the color, let's mix our bump map with the original albedo to get a sort of aged look. And then drag that into base color. Well, look at that! I'd say it looks pretty real. Almost as real as that subscribe button. They're so real, in fact, we might as well go all the way. Shift A, S, displacement, set strength to 0.055. Get a mix node set to multiply and fact to 1. Drag displacement into displacement and color into height. Drag the cracks into color 1 and the original albedo into color 2. You're done. Alright, congratulations! Look at that! 100% procedurally generated bricks. And because they're procedural, from here on, you have total control over any changes you need to make. So this is what the diffuse map normally looks like. Dragging this left and right controls how thick and sharp the separation between each brick is. The fact on this mix controls how toasty the bricks look. The farther left the more it shows up, the farther right removes the toast completely. The fact on this mix controls how much the cracks show up. You can remove them completely by dragging it all the way to the left, or you can make them show up 100% by dragging it all the way to the right. This color ramp controls where the cracks appear. The white allows cracks, the black hides them. Scale X and Y controls the shape of the cracks. The larger the X, the more squash they become vertically. The larger the Y, the more squash they become horizontally. This point controls how much wear and tear shows up. And this point controls how clean the final colored image is.  Alright, I hope that's real enough for you. My computer almost didn't make the journey, but I do it for you. If you enjoyed this video, please don't forget to like, subscribe and ring that bell. Hope you have a fantastic day, and I'll see you around.