This video is titled nested loop part 2. So in this video, we are going to take our 2D point matrices system that's creating our matrice of 2D points. We are going to make some geometry or transform some geometry with that. We'll input some geometry and use it to do a transformation. So we're beginning to automate or use looping to do some things that we did in the first lesson manually. Have our system. It's saving our points in a list and then we're looping through that list of points here. The only thing that we're doing so far is printing out the index number and then also the point values that's being held within that index slot, within the list as a tuple and then we're also adding the TextDot for the index number in the scene. So if I undo that for a second. So if we create simple piece of geometry like a rectangle, so the question is how could we? First thing we need to do is find the centroid of that rectangle, which we already know how to do and then we want to perform a copy move. We want to move a copy of a rectangle to each point in the matrice. So it's the first thing we want to accomplish. So if we go back to our code, first thing to do is to input that rectangle. It needs to be closed and planar or else we wouldn't be able to find the centroid of it. Then within our pointless loop, and I can turn these two lines of code off. I've created this section here called create transformation. Then now that I'm finding the centroid of the input curve, saving that in a variable centroid and then I'm finding the translation between that centroid and the current point within the list. I've broken this down like we did in the point loop and like I also showed what's the point lesson. I'm pulling out the X, Y, and Z values of each of those points and subtracting them and then recombining those because I put them in their parentheses. I recombine them as a tuple that expresses the translation value and then I use that to copy the curve object to each point. So let's run that and see how it works. So select our rectangle, add a stray up here. So let's copy that. Let's actually make that a little bit smaller. That happened before. Strays from an old code. So let's make a smaller rectangle here. That's okay. There's some overlap but what we're going to do now, so you can see, and actually I'm not generating. Let's generate our points until we see our point. So we'll do an add point here so I can see the center. So we can clearly see that part rectangle is being copied in this matrice of points using the centroid to copy each one of those. So let's perform a transformation. Can use one that we know, so a rotation. So what I'm doing in the loop here is copying that object and then I'm overwriting it with the same name, so I'm replacing it. Now I could do this differently. I could say instead of overwriting that I could call this curve new. Actually, I wouldn't need to change it up here because I'm just would be copying the instance of that curve over and over again. So I could do it either way. I'm going to leave it as the GUID. I just need a variable. Whether or not I'm overwriting the original one or not, I need a variable that's holding that new copied object because that's the one I want to rotate here. What I actually don't need is if I'm not going to do anything with that after this, I could delete that, but let's just leave that in place. So I've rotated the object. We've seen this transformation before, it's within the point list. So it's going to rotate around the axis that it's been copied to and then I'm using as my angle just straight up the value i. So the first one will have a zero rotation, the second one will have a one, then a two, then a three, then a four, so on all the way through the loop. So that's going to progressively rotate the rectangle as it goes through the loop. So the rotation value gets higher and higher as it goes through and then I at some point kind of losing the progressiveness of the rotation. So although it does create an interesting pattern, I might want to lessen the effect of that rotation. So I could divide it by a number in here and if I was curious what that number was, what it was producing, I could have also just printed out. I had to see the angles that it's reducing. That's one way to figure out what's the right number. So we'll run it again and now we get a more progressive rotation of the rectangle. We could also see our numbers. So you could see they're much increase at a much lower rate. If I did it at this at a lower, let's say halved it, 25, it changes the type of patterning that I'm getting. Or we could make it a lot higher a number and then let's say increase our range in X to five times the range, so it gives it more room to change. So you really start to see the potential of using iteration in coding is that you can imagine how long it would take me to do something like this manually and there I just did it in a couple seconds. The other thing I could do here is change. This could be an any closed planar shape I want, so I could have a much different shape. One last thing I could do, and we'll get into this a little bit more in later lessons. I'm going to change this back to 10, is I could alter this value by adding a multiplier or a divider, a little equation that's going to change that. I mean, one basic way to change it is data multiplier, which is going to change, it's basing. Now I'm just doing it in the X, so the points are spaced out more. So we'll show a few more things to do with this before doing the next assignment that is specifically dealing with this system.