Learn the basic properties of a vector component in Grasshopper: magnitude, direction, and sense. This tutorial also shows you how to add vectors together.

- Vector math is one of the most powerful tools we have for working with movement, force, and direction in Grasshopper. Unfortunately, it's not always the most intuitive way to work. In this chapter, we'll go over some practical applications of vector math by incorporating climate data into our Grasshopper definitions. In chapter four of the Learning Grasshopper course, we covered the basics of working with vectors. I recommend watching and reviewing those videos if you need to brush up on working with vectors and vector math. But if you're really itching to get started, here's a quick crash course.

I've got the example file 0010-vector-intro.gh open in Grasshopper. And that's in the 0050 folder alongside a blank Rhino file. So at their most basic definition, vectors are represented just as coordinates. In a two dimensional vector, you'll have two coordinates, one for x and one for y. In a 3D vector, you'll have three, like we see here. One for x, one for y, and one for z. And the way I have this definition set up right now, I just have a panel component.

And that's feeding into a vector geometry component. And if you need to get a panel component set up like this, you can just double-click anywhere on the canvas, enter a quotation mark, and type in your coordinates. And I'm separating each of these with a comma. So that'll give us a second set of coordinates, and we'll use that later. Now, vectors themselves aren't actual geometry. They're just information. And by default, you can't see them. So to see a vector in Rhino, we can use the vector display component.

So we'll pull that up. Again, I'm just double-clicking on the canvas and typing in the name of the component that I want. So I want vector display. So that's takes in a vector to it's v input. And then we also need this a input for the anchor point. And that just sets where in space the vector starts. So I'm going to plug in the same set of coordinates for both the anchor point and the vector. Now you might think initially that because the coordinates of both the anchor point and the vector are identical we'd get just a point or maybe an error.

But you can see here in my Rhino window, I actually get a vector. Because those two sets of coordinates are actually different pieces of information. The anchor point is just a point in space, while the vector's coordinates set its major properties which are the magnitude, the direction, and the sense. So magnitude is basically the length of the vector. The direction we can think of as the line between the vector's start and the end points. And the sense is the orientation of the start and end along the direction line.

So for example here, we can see the start of the vector and the end of the vector. That could be reversed. So it could have the same direction but a different sense if the arrow were over here at the beginning. So basically what's happening when we use this vector display component is that Grasshopper is using the anchor as the start point. Then it's calculating the end point by adding the vector's coordinates to the start point's coordinates. And to give ourselves a little bit something more to play with here, I'm going to select this whole definition here and just duplicate. So I'm left-clicking, and then holding down alt, dragging down duplicates of all those components.

And I'll just make some changes here to this panel that's feeding into the vector input. So, I'll just give that some different coordinates. And hit okay. So I can see here, I've got two vectors now with the same anchor point. So they're both beginning at the same point in space. But since we have different sets of coordinates feeding into the actual vector component, they're going in different directions, and they have different magnitudes. So in a lot of the examples we'll go through in this chapter, we'll have more than one vector, sometimes even hundreds of vectors.

And where vector math gets really powerful and useful is when we start analyzing and working with vectors in groups. Later on, we'll cover some advanced techniques like the dot product and the cross product of multiple vectors, but for now we can just focus on simple vector math by adding these two together. And for that, we'll use the addition component. So I'll just take the vector output from each of these, and we're going to add those together. And remember, we won't actually be able to see this until we plug in a vector display component.

So our added vector is going to be coming out of the bar output. And then our anchor point we can grab from either one of these panels. 'Cause again, that's the same point. So I can see here, I have this middle vector. So when we add two vectors with the addition component, the properties get treated a little bit differently. The direction and the sense are averaged together. So it makes sense that this new added vector is right in between our initial two. The magnitudes get treated a little bit differently though. They're actually added onto each other.

So that's why that inner vector in the middle is longer than the other two because it's combining the magnitude of the first two that we added together. Now, luckily Grasshopper has lots of components for precisely adjusting the individual properties of any vector. So for example, we could pull up the amplitude component. And that could help us adjust the vector's length while leaving the direction and the sense intact.

So let's insert that right between these two components here. So that's going to be our vector. And that'll feed into the display. Just give myself a little bit more room here. And for the amplitude input, I'll just plug in a number slider. So I'll give myself a number between one and let's say 20. So I just need to type in one, and then the less than sign 20, and that's going to give you a number slider of integers between one and 20.

So I can see here now since I'm setting the amplitude of that added vector to one, it's very short, and it's down here in the middle. And as I slide this up, the amplitude increases. We can find lots more components for dealing with vectors under the vector tab. We have this whole vector sub-menu. In later chapters, we'll get into some practical applications of some of these more advanced techniques, like the cross product and the dot product. But that should get you up to speed on the very basic parts of information that are important to know about vectors.

###### Updated

10/26/2018###### Released

10/25/2017By the end of the course, you'll see how even basic literacy in Grasshopper can be applied to developing projects for art, manufacturing, architecture, and design.

- Working with algorithms
- Modeling a base profile
- Extruding elements
- Finishing an algorithm
- Planning for mass production
- Customizing Grasshopper
- Scripting with Python and Visual Basic .NET
- Modeling data with Ladybug
- Creating a tiling grid
- Tiling 3D objects
- Using reflection symmetry and mirroring to repeat tile
- Tessellating tile in any direction

## Share this video

## Embed this video

Video: Vector review