Simple Vector Field – Example 6.1

01_4This example serves as an introduction to the concept of Vectors and Vector Fields. Working with Vectors can be initially a bit difficult to grasp, but it is fundamental to creating many types of dynamic geometry and is well worth spending some time to understand and work with.

So the first question is, what is a vector? Vectors have two general components. A direction, and an amplitude. Many times we are only interested in the direction, while other times we want to know the speed as well. The basic vectors in 3D modeling you already know. They are the direction of the world axes, x, y, and z, and we needed to use them since the first exercises in order to move geometry.

A vector can be set in several ways. The first is to draw two points in space, and define the vector as the direction and distance (which determines the Amplitude or Speed) between them. In a 2 dimensional space, the vector has an X and a Y component. In a 3Dimensional space it has a Z component as well.


source: Wikipedia – Vector

Hopefully this makes sense, and it will make more sense as you work through the exercise.

Step One – For this exercise we will start once more with a Square grid of points, and will also draw a point in Rhino that falls somewhere inside or near the points in your Grid. Reference the point into a “Point” parameter container.

Step Two – To setup the vector, we are going to use the “Vector 2 Point” component. This requires a simple point “A”, which will be our flattened grid points, and a point “B”, which will be the referenced point from Rhino” You won’t see anything when you do this since the vectors are not geometry, but are directions with an Amplitude. To see your vectors, which is always quite helpful, you can use one of the two “Vector display” components. The simpler of the two requires an anchor point, and the vector. You can think of the vector as a wind direction (also invisible) and the Anchor point as a post for a weather vane. The vector display shows what direction the weather vane would point in. Once you display your vectors it should look something like this.


Actually it won’t look like this. The arrows will connect the points but it can be messy. To get this image I used the “Amplitude” component before drawing the vectors to take the direction of each vector, but to reset the Amplitude (Speed) to a fixed constant. You don’t need to do this, but it could help if you are having trouble seeing what is going on. Note also, depending on which set of points you plug in for A and B your arrow heads could be reversed.

Step Three – Draw Geometry. In this example, I am going to use the vector to draw some rectangles that are anchored to the grid points but which orient themselves to the Vectors. To do this, I first draw a line with the “Line SDL” component (Start Direction, Length). The start points are the anchor points, the direction is the Vector, and the length will be determined by a slider. I then offset these lines in both the positive and negative directions based on a slider to determine my rectangle thickness. Using the start and endpoints of these lines, I then construct a rectangle using the “Rectangle 3Points” component.

That’s basically it although you might want to change these into surfaces and color them if you want to make it look prettier.

Below are some variations. In the first row I just moved the reference point. The first is out of the field, the second is towards the middle, and the third it is at a corner.

In the second row I changed the thickness of the rectangles.

In the third row, I made the rectangles very short in length and very long in thickness. This effectively orients the geometry perpendicular to the geometry. This might work good if you are trying to model a solar array. Pretend the point is the sun and move it across the sky and watch the solar panels adjust!


And finally here is an image of the grasshopper script


Click Here to Download GH Script