The name of this video is 3D Matrix Wall Example. So I want to end this lesson by going through an example of a wall project. That's a good example related to what you're going to be doing in assignment four. Of course, in assignment four, you're going to be working with the 3D point matrix code that we've been going over. And you're probably going to, well, certain parts of that code are going to stay the same to the given code. So how you create your point matrix. You're going to use all that. You might change some things in terms of how you might be randomizing, or adding to the point values. Your main is going to look like this. That can stay the same. And really, where you're going to work is in this second loop, where you're really going to create your geometry. So this is really where you're going to do all of your coding here. You might be creating some functions, or you might be using some of the functions that I've shown, like the midpoint function, or the random radius function, or midpoint pull point function. So those could be added if they seem appropriate to use in the code. So the other thing you're going to be doing too in this, you're going to be using this model that we have of the 3D matrix structure. And you're probably going to be doing a lot of manual modeling with that structure to figure out the pseudo code of what you want to construct is your module. What's your geometry going to look like? What's the logic of that? So you actually have to do a lot of manual work here, maybe some sketching also to really figure out what it is you want to create within the code, before you go in and code it. So as an example of that, I came up with this idea that I was going to have a rectangular rear profile in my matrix, and then it was going to have a rectangular front profile. But I wanted that front profile to change position, based on some random integer generator. So it would be different each time that it produced the module. And so I came up with this idea that there would be a sort of nine quadrant grid that defined where that rectangle would be, and if it could, Be created, In one part of that grid. And then I would draw a profile line from the back rectangle to the front rectangle. And use a function, which we actually haven't seen, called Sweep2. Although, you've probably used it in Rhino, which takes two rail edges, and a profile, and creates a surface based on that. So that was my idea for a module that I was creating. And so I had a couple problems dealing with that. One was probably the most major one, was how do I create this grid? And then how do I set up a system that chooses between a section of the quadrant? So [COUGH] the first problem to create the grid, what I did was I created a surface from four points. And then I'm going to rebuild that surface, just going through the process here in Rhino. And if I change it from a 2 point count to a 4 point count, We'll see that's going to create this grid of points, and then I can extract the points from that. And then I also need to find out what the order of those points are. So if we go to our code, we'll look at this first section. So creating the back curve is no problem. Although, I do want to be cognizant of the order of the points in which I'm creating it. I'm creating also a one degree curve, and I'm starting in the lower left-hand corner. So I'm starting down here, and I'm drawing the curve in this counterclockwise way. Because I want to make sure that I also construct that front curve in the same exact way, because this is the starting point. I'm going to draw the profile line from the starting point from this curve to the starting point to this front curve here, check and put back in here. I want to make sure that that's also drawn in the same direction. Okay, so that's the back curve, and then the front curve. So first, I create that construction surface using the front points of the matrix here. And then I rebuild the surface. So this is a function we haven't seen, but it's fairly straightforward. It accepts a surface. I can set the degree of the surface, and I'm just going to set it to 3. And then I can set the number of the point grid, and then use surface points to extract the points from the surface. And then I've created a little function here called numbered points, which I call with the surface points. And all this is doing is numbering the points in that point list. Because I need to understand if I'm going to draw these rectangles with these points, I need to understand the order of those points. So I'm going to run this and we'll just produce one part of my matrices, and we'll see that point order. So let's run it. And so I'm just going to select a maximum two, two, and two. That's not producing my numbers. I gotta turn that off in the, yep. So let's do our numbers here, two, two and two. Okay, so that's showing me the order of my nine quadrants. And then I understand if I want to draw, This rectangle, let's say for this first quadrant here. I go from point 0, to point 4, to point 5, to point 1, back to point 0. And that's going to give me that rectangle in that first quadrant. Okay, so once I understand that order, I could take this, move it over. Then all I need to do is for this, I can turn this function off, because I don't need to call that anymore. Then I'll undo this. So then I no longer need that construction surface, I can delete it. And then I'm going to generate my random integer. It's a function we've seen before. So it's generating a random integer between 1 and 9. So this is really the brain of the code, because I have 9 quadrants here. So I wanted to randomly select 1 that it's going to draw them draw the rectangle in. So selects between 1 and 9. And then I just decide which quadrant is which. So if it's quadrant 1, then it's drawing between these points. And then it's also going to add that profile line from that back corner to the front lower left corner point, so it will do that for each one. So that's here. So if this was 0, 4, 5 and 1, so that's going to be down here. So that's the rectangle for 0, 4, 5 and 1. And then it's going to draw that profile along this bottom edge from that point to the 0 point. And then I just write that code for each quadrant. Okay, so you have the order of the points here. And it's just writing that out, so if I was doing this, I didn't do comments a pseudocode. But you could write out the pseudocode for what points are going to go between, if that's helpful. It's a fairly straightforward code, so you could just write it in the code. And then the only last tricky part of this is using the AddSweep. If we look at AddSweep, we can see that what it's looking for are two lists. It's asking for a list of rails, and a list of shapes. Well, I only have one shape. The shape is the same thing as a profile. I only have one shape, but it still needs a list. And you can see in the example here that it's using GetObjects. So GetObject, so is returns a list. So even if I only selected one shape, one profile, because it's GetObjects, it sees it as a list. So it's seeing these two as lists. Well, the problem that I have in the code was that the profile was just simply a variable that's holding an ID. So it's not a list. So I actually need to do a little sort of trickery here, and set the profile equal to profile just within brackets. So now this function sees it as a list, and then that should work. So let's go ahead and run it, see what it produces. So we'll do 5 by 2 by 5. Okay, and you can also see here, this proportionally doesn't have to be a cube. You could really change the proportions of that. I'm making it a bit narrower. Could run it again, and in this project, you can play around again with your variables here like I could, add my kind of Fibonacci, Series right here, just in the x and the z. I could expand the number, In my grid. So I start to get more variety of things. The other thing you might want to play around too within this exercise, this assignment, is how you're rendering things out. So you might choose something besides shaded, or wire frame, or ghosted. You could do a sort of rendered version in light and shadow, since the wall is going to probably accentuate some of those things. So I hope this was helpful seeing this example. And as always, the code will be posted, so you'll be able to go through it yourself.