Projecting and Orienting Geometry – Example 5.2


This example introduces two very useful tools to use in 3Dimensional landscape models. The first deals with the problem of getting geometry that is drawn in 2 dimensions onto a 3D surface. This can be done fairly easily through the use of the “Project Point” and “Project Curve” functions. The next useful modeling task is to orient geometry. This is useful for putting repetitive elements into a model in various orientations. In this example, I draw in Rhino a simple “gate” based on the project by Christo and Jean Claude, The Gates.  This gate is then oriented to follow paths at regular intervals. This same logic can be used for other items that follow paths. For example lamp posts, alleés of trees, etc…

Part 1 – Projecting Geometry

These are the objects I drew or modeled in Rhino prior to going into Grasshopper

These are the objects I drew or modeled in Rhino prior to going into Grasshopper

For this exercise, I am using the surface that I developed in Example 4.3 although most any topography will do. This is referenced into Grasshopper using the “Surface” parameter component. I then sketched out some potential path configurations using the draw curve tool in Rhino, and also referenced these using the “Curve” parameter component.

Reference Images for Part 1 operations in Grasshopper

Reference Images for Part 1 operations in Grasshopper

Step One – the first thing to do is to project the curves up to the surface using the “Project Curve” component in Grasshopper. This will align our 2D curve with the 3D surface. Before working with these curves I “reparameterize” them by right clicking on the “C” output and selecting “reparameterize” What this does is it resets the curve so the start is parameter “0” and the end is parameter “1”. The midpoint would then be parameter “.5”, the quarter points parameters “.25” and “.75” etc. This is necessary for the next step.

Step Two – What I want to do is create a “Sweep” along the entire curve of a line that is equal to the path width. This takes quite a bit of setup and is not as easy as in some 3D modelers. Basically we need to orient our geometry to sweep to the beginning of the curve. To do this we need to create a new orientation plane at the start of each curve. Use the “Evaluate Curve” component with the “t” input (the parameter to evaluate” set to “0”. This is the start point of each curve if you reparameterized correctly. This will output the point in the “P” output but more importantly will give you a vector called “T” which is the tangent of the curve at the start, which corresponds to the exact direction of the curve only at that point.

This I am going to use to create a new plane. Planes is another topic that is hard to grasp in Grasshopper and often the planes do funny things, so you need to figure out what is the best way to create the plane for what you want to do.  In this particular case I tried many different approaches, but the best was to deconstruct the Tangent vector to obtain only its x and y components (since I don’t want my planes to tilt). I then draw a vertical plane (plane YZ) oriented to the start point, which I then adjust based on the X and Y of my tangent vector. I know…it makes little sense! But the previous ways I had done it ended up creating buggy results, for example some methods worked if the curve had a shallow slope, but stopped working with a steep slope… sigh. I wish there were an easier way and their probably is, but for now just do what I did. I will explain this again in step 2 so hopefully after trying it a few times you will start getting the hang of it.

Step 3  – Orient and sweep. I drew a simple line in Rhino the width of my paths. I could have drawn this in GH but I didn’t this time. This geometry is then oriented to the plane I just constructed at the start. To do this you create a reference plane, in this case just using the midpoint of the simple line I drew in Rhino will do, and a Target plane, in this case the plane at the start of each curve that I just described. What this will do is put your line at the start of the curve, perpendicular to it, and ready to be swept. (See image 3)

The “Sweep1” component asks for two things. A “rail” (our projected curve) and a geometry to sweep (S – our reoriented line). After sweeping this creates a surface that runs pretty much exactly along the surface. I wanted to give the path a bit of thickness so did an “Extrude” to give the path .45 meters of thickness, so it would show up well in the rendered view. So now the paths should all work. In this example you can have as many curves for paths as you want and it will perform the sweep on all of them. If I were to adjust my surface, the paths would also adjust to the topography.


Overall Script for Part 1

Part Two – The Gates

Reference Images for Part 2 - "The Gates"

Reference Images for Part 2 – “The Gates”

Step One – Orienting the gates follows a similar process and mental gymnastics with planes. First I use the “Divide Length” component to divide my curves into regular spacing for my gates. A gate will appear at each one of these points. Note Divide Length also gives you a Tangent value at each of the points. i deconstruct this tangent since I am only interested in the X and Y components of this vector. I throw out the Z because I want my gates to be vertical, not tilted at all. I then rotate this vector 90 degrees since the tangent is more or less parallel to the curve and I want a vector that is perpendicular. I use the “Rotate Vector” component, not the standard rotate geometry component. and rotate the vectors around the world Z axis. The last step is to create the actual orientation plane. Using the rotated vector and the World Z this is possible. Why use Z for Y? mental gymnastics. Since I drew my gates flat on the xY plane, I now want for them to rotate into an upward position. If you look carefully at both the origin planes and the target planes in the image above, you will see the relationship between the Y (green) axis in each one. This is hard to explain again in simple blog post but if you display the planes and work through the example maybe it will make more sense.

Step Two – Once the planes are all in the proper orientation, I use the “Orient” component again to pick the planes up from the original reference plane which is then rotated, skewed, distorted, contorted, until it gets to its destination (the target Plane). If you set it up right though, every single one of the gates will have a unique position and orientation based on its relationship to the path curves.04_07scriptB

Now you can try variations. move the lines in rhino to move the paths to better positions in Grasshopper. Or just do like they did in San Francisco and try and put a grid onto a rolling steep terrain!


A note on “Perp Frames”.  Grashopper has a component called “Perp frames.” Ostensibly this will create frames perpendicular to a curve. Why not just use this? Because it is a false friend. A perp. The orientation of the perp frames is completely unpredictable. Sometimes the Y axis points up, sometimes down. Maybe you can get it to work, but I had to give up 😦