This video is titled 2D surfaces example three. So in this video, we have an interesting little problem, if we can create a 4 point surface from these corner points by just inputting that list of points and we can create this surface. So I've done that in the code using our, Our add surface point, which takes a list of either 3 or 4 points, so it's either going to make a rectangle or triangle. We can run that, So that's creating a panelized surface, which is kind of cool. But if we take a close look at it, we'll see that each one of those panels is twisted to fit the geometry of the surface. What if we set up the problem for ourselves that we wanted to, if we were going to, let's say, actually construct this. It would be difficult to do as each one of these panels has a sort of custom twist to it, custom surface. So what if we wanted to make a doubly curving surface like this, but only using planar materials? So that's an interesting coding problem and interesting construction problem. So if we go back to the matrix here, if I delete that out, I start my framework here, so I can sort of understand that, so twist in space. So how would we do that? Well, one way to do it would be to find a plane from three of these points. So that would be the first step, and I can use my set C plane by 3 points, so I'm going to use this negative, negative as my origin. This is my x-axis and that's my y-axis. So I've located a plane relative to that module and I'm going to show how to do that in the code. And then I can find a point on that plane, Using the fourth point. So in Rhino, I have something called ProjectToCPlane, And that's going to project any geometry that I've selected to that plane. So it's essentially finding the closest point on that plane to that test point. I can then use my surface points, To find that planar surface. So let's go through those steps in the code to do that. We also see, we're going to have a little gap here, we're going to take care of that after, but we'll create this plane first. So let's get rid of this, unhide that, and we'll get to work. Okay, so the first problem is finding that planar point, so we're going to go through our same exact loop. Since I'm using my negative equations, I need to have this conditional in there. And we've seen this, so we're going now back to our exercises that we did for finding our plane, and the most common way to do that is using 3 points. So we're going to use our 3 points from the matrix to do that, and we're going to save it in a variable called plane, so PlaneFromPoints. So this is my origin, this is my x-axis and this is my y-axis. So the x-axis is i, j- 1, j have here and then the y-axis is i- 1j. Which j have here. So I found that plane, and of course I won't see the plane in space, the only way I'm going to be able to see it is if I create something on it. So we're going to go ahead and create our point, and this is where it gets a little, Interesting. So this is a function we haven't seen before, PlaneClosestPoint. So this is going to find a point on a plane, this new plane that I've created just here using a test point. So the test point I'm using is the fourth point in the matrix that I'm not using to create the plane, so that's this point, my i, j point. Okay, so we're going to do that, and then we're just going to render that out, so we can see it. So let's go ahead and run that. Okay, that's creating those points and not creating the planar surface yet, but it's creating those points. Now some of those points are going to be above the surface and some are going to be below depending on the twist of my surface, depending on the geometry. Is this a concave or convex point in the curvature of the whole base surface? And it's going to just determine that based on creating the plane from those three points. So now I need to save that point that I'm creating, that planar point in a new dictionary that I'm calling plain point. And I save it as a dictionary in the dictionary structure because I want to be able to access it in the same loop that I'm going to be accessing my point matrix. So I want those things to be relative, so it's saved in the same exact structure. Once I've done that, I can then go back in here and create my geometry, so now here I'm going to create my 4 point surfaces. But instead of using this point, I'm going to replace that point with this point, my plane point. So all I have to do is change this here to plane point. So now instead of drawing that surface between these four points, so I'll draw it between these three and that new planar point. And let's run that. So now it's creating my planar surfaces, and the last thing is if I want to make this a closed surface, I'm going to create these little infill triangles. So I can do that by creating a surface 3 point surface, so this is starting at i, j and I want to go in a counterclockwise direction. When in clockwise direction, so i, j that point, that point, All right, so those two triangles, the code for that. Is here, So i, j to the plane point to i, j -1 for the first one, and then i, j to i- 1j and then the plane point, and so that's going to create my little infill triangles. Okay, lets round that, So now it's creating a closed surface that can be made from planar surfaces. Which is kind of cool. So, one question I get a lot about working with NURBS surfaces is how do you use them with poly surfaces? And you can run them on individual surfaces if I have a matching edge. And ice occurs between poly surfaces then that geometry is going to align along that edge, so this is a tower form that's made up of separate surfaces. I could run that code and if I have the same giving at the same interval for the edge which is going to be the U here, U direction along that edge, then those edges that geometry should line up. Now the other question is, how could I run it on multiple surfaces at once? Go back to the code here, I've made a change in the main to instead of just getting an object, a single surface, I'm going to get multiple surfaces. So GetObjects brings in a list, so I'm going to be able to select all those surfaces, and then I've changed my variable here to reflect that. I'm going to turn this hide off because I would get an error from that. And now down at the bottom of the code here, I'm using my EnableRedraw since I'm going to deal with a lot of geometry, I don't want it slow the curb down. So what I'm doing here is I'm looping through that list of surfaces, and then I'm taking one surface at a time, and then calling my function. So I'm calling my function using just one surface at a time and putting my intervals values each time. Okay, so now if we go back here and let's change it to Render. Run this So it's saying select surfaces, so I can select these all at once. And then I'm going to set a higher U value, since I have a longer edge here, so let's set that to like 15. And then my V which is this direction, I'm only going to set to 3. And because I used EnableRedraw, it worked that fast. Now this is definitely more subtle than the other surface because of the size of the pieces, but you can see that it's still producing good planar geometry.