Understanding Curves in Grasshopper

As we looked at the points datatype in the previous edition which is the foundation for any modeling software, curves are connections between these points. It can be as simple as a straight line between two points or as complex as a NURBS curve which uses control points to define the shape of the connection.

Creating these curves is very easy but placing them accurately and shaping them to give your model the look that you want is much harder. With that said, let's peek under the hood of how Curves in Rhino/Grasshopper work.

NURBS Curve

Rhino and Grasshopper use what is known as non-uniform rational B-spline or NURBS for short. You can look at an official definition [here](https://wiki.mcneel.com/rhino/nurbs).

NURBS Curves are controlled by 4 things which are a curve’s degree, control points, knots, and evaluation rule. Each component plays a big part in generating the curve, but I think the component that we have the most control over is the curve’s degree and control points.

Since control points are just about how many points are and where they are placed, I think it’s important to take a look at how the degree affects the curve.

Curve Degrees

To show you this, let's look at three curves that have five points between them in Rhino. If you want to follow along, you can create these lines with the line command then followed by the Rebuild command and choose 5 points and enter degrees 1,2, and 3 for the three lines.

Now watch what happens when I shift the middle point upwards (in the Y+ direction).

As it clearly shows the steepness of the curve is reduced as the degree of the curve is increased. Or, in CAD jargon, the degree of the curve also increases the "smoothness" of the curve.

Also, if you noticed, the curves of degrees 2 and 3 no longer touch their points. This means as we make the curves “smoother”, we also sacrifice a bit of accuracy.

Grasshopper Curve Datatypes

Curves not only govern the look, feel, and quality of your model but are very useful in geometrical operations because they are quite versatile. To manage that versatility, Grasshopper has created several data types to help us which I categorize under three types.

Lines

Lines are the simplest to understand in the Curve family. They simply consist of two points and a straight connection between them, they are also referred to as curves of degree 1.

But what makes them unique is how Grasshopper treats them. The data type Line is typically treated as infinitely long whilst the Curve datatype is finite. let's look at what this means in Grasshopper.

This may seem a bit unnecessary but this has many benefits and is very useful especially when it comes to intersections. For example, if we wanted to find out where on the rectangle does the line hit.

Instead of incrementally increasing the length of the line until we see it reach the rectangle, we can actually use the Line|Surface component in Grasshopper to find that intersection because Grasshopper treats Line as infinitely long.

Shapes

Then we come to shapes that can be either open or close with special properties attached to them. These properties normally take the form of shape dimensions. This is because Grasshopper knows that it is easier to manipulate the dimensions of a shape rather than moving the raw coordinates of their points.

Grasshopper has attached these dimensions for various shapes like rectangles, circles, and arcs.

Curves

Curves are the catch-all container for any type of connection between points. That means you can convert a Line or even a Shape to the Curve datatype. The reason you might want to do that is to carry around less data or to explicitly make a Line a Curve, or to extract an edge from a Shape.

To explain this a bit more, let’s look at an example. Let’s say you wanted to find the intersections of this line and this curve, like so.

And you only wanted the points where the line and curve meet. In grasshopper, you have two options to find the points where the line and the curve intersect, the Line|Curve component or the Curve|Curve component. Here's the difference in results between the two components.

So, even though, your first instance may be to treat the line as a Line, you would actually be getting the wrong information back because Line is treated as infinitely long. To get the points where the line and the curve meet, you need to treat both of them as a Curve data type.

Final Thoughts

Curves are both simple and complicated. Aside from the controls of a curve, there is even the need to understand the difference in how Grasshopper treats them. It can seem very confusing at first but like all the other geometry types, using them more will help make this distinction more intuitive.

It is important to understand how curves work because they are the foundation for creating surfaces and often govern the look and feel of your model. But as always, we will have plenty of time to look at curves in depth later as we look at different modelling workflows.

This article is part of a 6-part series on Grasshopper geometry types. Where the aim is to use Grasshopper more effectively by understanding how Grasshopper processes geometry data.

Part 3 - Understanding Curves in Grasshopper

P.S. I also made a Youtube video explaining this exact post.