This video is titled 2D Point Matrix Dictionary Part One. So, in this next couple of videos, we're going to really look at how we can implement the dictionary structure in the 2D the point matrix code that we've been working with, and how that changes fundamentally, how we can create geometry without structure. So the first thing to look out, we're going to start with a code that should be familiar to everyone now. It's this 2D matrix where we have nested loops to create points. I'm rendering the points within the scene, and then I'm saving them within a list. And then I loop through them again. So I can label them with the index number in whichever index number they are, as I loop through. So let's run that and we'll take a look at it. So, one thing that we notice right away about this structure is that it's linear in order. So as I create the points which start down here at zero, and go up, and then come back down. We've discussed how this really shows the structure of the nested loops. It's only recording those points in this linear fashion. And that's really the only way that I can access them as to deal with their linearity. But what we really have is a grid structure. And if we think about it, we think there must be a way, if I reorganize how these points are saved. I could reorganize what their relationships are, and how I can identify them within this grid. So if I could save them instead of in a linear fashion, if I could save them in a column and row fashion. So if you imagine something that's pretty common like Excel. Excel is a grid structure, and it's organized into columns and rows, right? You have your columns are defined by letters, A, B, C, D, E, F, G, so on. And then the rows are defined by numbers starting at 1 at the top and going down. So how can I reorganize this in that type of structure? Well, I can use a dictionary to do that. So if we go back to our code, And instead of using this point list, if I turn that off and create a dictionary, an empty dictionary here outside of my loop. And instead of saving the points in a point list I save them in a dictionary. So what we looked at same structure that we looked at in the last video. So using the the ij as my key value to save my point values in. Then I can turn off this section of the code because I'm not going to loop through that anymore. Let's turn this section on. So, I need to go through my nested loop since this is an important point to make. We did this in the last video also in order to access the data in the dictionary since it's saved with a nested loop structure. It's not saved as a linear list. It's saved as this nested loop. So in order to reaccess that, I always have to run it within a nested loop. Now I'm just going to before I do anything with it, I'm going to print out the i and the j. So I'm essentially printing out what my key is, and I'm showing the associated value. So what's held within that i and j at that point, so we'll print this out. And so it's printing out my key values, and then it's printing out the point. Now something important about this is that the key values are pretty simple, and they're sort of simple relationships. There's just integers and organized in a straightforward list. The point values, although they look organized, they could really be anything at all. So if you imagine if I randomize this, or if I give a multiplier here, that's some decimal factor like 3.213. Maybe I give a different one here. I could get, really wildly different point values, and that's not going to really affect the key structure at all. The key structure always stays sort of organised and straight forward. It's another reason to use this. Now let's take a look at we're not printing out, I'm not seeing the key structure in Rhino space yet. Let's take a look at that. So it'll start to make more sense. Stick this back down. So I'm going to label those points in Rhino space. So I'm labelling them with the key assignments, and showing that for each point within the matrix. So let's run that. So now we can really start to see that key structure now of the matrix. So I already understand that the way the nested loops creates the matrix is it starts down at the bottom here. It goes up till it runs out of j, and then it comes back down, goes up again till it run out of j. So were adding one to i each time, and that can also see what this dictionary structure does, it gives me that column and row organisation. So now I have columns starting over on the left here that are defined by i. So 0, 1, 2, 3, 4, so that's the same sort of all the way up. So that's my 1 column. That's my 0 column. That's my 2 column, and then the j are defining the rows. So 0, 1, 2, 3, 4, another way to think about is that the i's are defining the sort of x direction, and the j's are defining the y direction. Now, if I look closely at part of this, and let's just pull a kind of module out. We can get rid of the rest of this. I could start to think about an equational relationship between the different sort of points within this module. So, if I understand them as not 11, 01, 00, but if I understand them as i and j, how would I rewrite their values? So I've already done that. Over here, I'm going to unhide it. I've written them much bigger so we can, See them better. But it's the same exact relationship. And so, if (1,1) were (i, j), then (0,1) would be (i-1,j), (1,0) would be (i, j-1). And then (0,0) would be (i-1,j-1). And so we're going to use this structure, what we can do is, we could because as I would go through the loop and go through the count, this is going to give me the ability to create geometry in a modular way. So, I would be able to let's say if I wanted to draw a curve from each one of these points in the code, I could do it in using these expression, (i, j), (i-1, j), these are defining sort of points. As I go through the loop for each point, it'll be a very efficient way of creating that geometry. So we're going to take a look at that next, how we can actually use this structure to start to make geometry in a different, in a modular way within the matrix.