This video is titled Planes on a Curve, so in this video, I'm going to be dealing with a curvy three-degree NURBS curve that is not in any plane at all. But what we're going to be doing is finding planes from what's called the normal of the curve. And the best way to represent that, and really the tool that we're emulating in Rhino space is this set C plane to perpendicular curve, which I have down at the bottom here. Some of you might have used this before. It's really nice tool that allows you to sort of find the C plane anywhere along any curve. And then I could construct geometry around that. And what this is really doing is, it's using, if I type in dir, Which is going to give me of course the direction of the curve, which I've talked about before a little bit. But if I slide my mouse along that curve, it shows me this arrow in kind of changing positions. And that's really the normal of my curve. And so I'm creating a plane, this C plane is really being created perpendicular to the normal of the curve. So the question is, how would I do that in a code using the curve as an input? So let's reset this, And go to our code. So first I'm going to, just as a demonstration, we'll divide this curve and create a series of points. And so the question might be, how do I create this, find this plane along this sort of series of points along this curve? That's a good demonstration for finding points along the curve, but I don't really use that to find my planes. What I'm actually going to use is something called the domain of the curve. Which I spelled wrong here, so domain of the curve. If we go into Rhino space and I click on the curve, and I type what, and look at some of the data that I get, it's telling me I have an open NURBS curve. It's a three-degree curve, and it's giving me the start and the end point as points in Cartesian space, xyz values. And it's giving me some other information about control points, but then it's giving me something called a domain. And it's giving me a value that's from 0 to 31 point something. Now if I click on, let's close this for a second, we click on that curve and we type in length, we'll see that the length is something different. So the length and the domain of a curve are really two different things. Although the domain might scale up if my length scales up, they're never the same. So let's type what again, and really, what the domain is is a part of the equation that defines the NURBS curve. And we would have to get into some pretty heavy mathematics to really understand a NURBS mathematically, and we really don't need to in order to work with it. There's actually tomes, volumes of books about NURBS curve geometry. As designers, we thank the mathematicians for creating these forms. But we don't have to understand absolutely everything about them. But what I can understand here is that domain is two values, it's a start and an end value. So when I find that within the code, I can use a function, Called CurveDomain, and that's going to return those values. So here, I'm going to print that out and we'll take a look at it. And that's actually returning a list of two values. So my domain, let's say 0 would be the first value, which is 0. And the domain 1 would be my second, my ending domain value, which is that. So those two values are important because I'm going to use a number between those values as a parameter for finding my plane along that curve. Set this back to that. So that's our next step here. So find a plane perpendicular to the curve normal at a specific parameter. So there's a function called CurvePerpFrame. Now if I look in my help, there's two, I don't want to get confused. There's something called CurvePlane, and that just returns a plane from a planar curve, which I don't have in this case. Or the plane in which that planar curve lies, could be handy, but it's not exactly what I want. What I want is this CurvePerpFrame, and that's going to take the ID of a curve, and then it needs a parameter in terms of a number. Now, a parameter is, anytime I see a reference to a parameter with a NURBS, it's asking for a domain value. So I'm going to give it a value somewhere between those two numbers, 0 and 31. I'm going to give it 15, and I'm going to give it the curve, and then see if creates a plane from that, I'll print it out. And it does, it returns my plane values which I recognize as a plane from the last lesson. And then to really see that plane, right, we need to create some geometry. So I'm going to add a circle at that plane of radius 2. And so it's creating that circle perpendicular to that normal, so I know it's working. Now, what if I wanted to, like I did when I had divided my curve, I had a bunch of points along that curve. What if I wanted to create a plane at each point along a curve, how would I do that? Well, I have my domain values, and I could set up a little equation to find what's called the step. Okay, and the step is, A value which is essentially a division of the domain, based on the number of intervals. How many times do I want to divide it up? And so I had 8 up here, so we'll just use that. This is an important factor, so I'm going to divide the domain by that interval defined this step value. But it's important because the domain is a list of two values. I know it starts with 0, but it might not, for some reason, if I sort of trim the curve or, for some reason, the starting was not at zero. And then that would mess up my equation. So I write the equation this way, where I take the ending value and I subtract the beginning value to find its total domain length, and then I divide that by the interval to get my step value. So we can run that, that's my step value here, 3.9 something. Okay, so I'll do that. We can turn this off because I'm not going to create that circle. Now we're going to use that step value in a loop. So I'm going to loop through my interval. And actually, let's take this out. So we'll loop through our interval values, that's going to be our counter for how many planes we want to create. And I've gotta create a plane at my step value times i, right? Because each time I go through my loop, my step value is 3.9. And the first time through, that value is going to be 0 because i is 0, anything times 0 is 0. And then it's going to be times 1, which is 3.9, and then it's going to be times 2. And so the parameter value is going to move down the curve. So let's run that. And it's producing that. Now, because my counting begins at zero, I'm missing my last value here. So actually, in this system, I need to add 1 to my interval to be able to get that last value. Okay, Now, just for a bit of fun, what if I wanted to write a little equation that diminished the size of that circle? Right, starting at a at a larger number, and then dividing. I need to do an add 1 here because if I tried to divide by 0, I would get an error. You can't divide by 0, so I need to at least start at 1. I could put a conditional in here to do that, but that's just the same. So let's run that. Now it's creating my diminishing size of circles that are perpendicular to that, showing me all the planes that it's creating, or demonstrating all the planes it's creating, I should say. Now just as an added thing, we could create a list called circles. And then we could append each circle in that list. And then after I'm done, I can just loft those circles. Since they're created in order relative to each other, I shouldn't have any twisting, and it should create them in the proper sequence, so let's do that. And it creates a little pipe or earphone, whatever you want to call it. But that's another very handy way of a set of things to at least start to also understand about NURBS curves, but also how to use them to create planes to then generate other geometry.