Surfaces from Points

From TOI-Pedia

Introduction

LEVEL: INTERMEDIATE

This tutorial is a continuation of Grasshopper 3D Grid from Surface. It creates a series of surfaces between 2 input surfaces. This can be useful in generating a deformed three dimensional grid of points, for example, where every cell is defined and deformed in three dimensions. There are a few ways of doing this, and this is only one example.

Surface Divide

2 lofts between 2 curves each defined in Rhino


To start, in Rhino, you draw 2 curves to be lofted (in Grasshopper) into a surface. By changing the control points of these these two curves, the surface responds. We have explained this technique before see:Grasshopper 3D Grid from Surface. Set the two curves from Rhino and use Surface » Freemform » Loft to loft between them.


To define the second surface, you do the same. Space the two surfaces apart. With this definition we will build a series of surfaces in between these two pre-defined surfaces that equally divides the distances between the two. If you alter the outer surfaces, the inner surfaces will respond as well.


In order to define the distances between the surfaces, we need to extract the same number of points on both surfaces and connect them to one another. We use Surface » Util » Divide Surface to do this. By default the U and V values are set to 10. You can change this with a Number Slider.


How to extract a parameter from a Grasshopper component

In general, it is good practice (also see:Grasshopper "Good Practice") to define important parameters with a parameter container. This allows for a good overview of your file and easy re-use of parameters. To do so, right-click the parameter U and select Extract Parameter. A new integer container appears. The same container can be found in Params » Primitive » Integer. Connect a Number Slider to control the value of the parameter.


In this case, we extract both U and V parameters and give them a Number Slider. Use the same U and V values for both Surface Divisions. This is important to make sure there is an equal number of points on both surfaces.


Now you have a number of points on both surfaces. In the next step we will connect the points and create a 3D grid of Points.

3D Grid of Points

Creating the Lines between the 2 surfaces to generate a 3D Grid of points

If we want to create a series of surfaces between these two original ones at equal distance from one another we can draw a line between the two surfaces and divide this line equally.


First, with the Curve » Primitive » Line component, we draw a line between the points on the surfaces. Since you've divided the surfaces with the same number of U and V values, the data structures correspond and the lines should easily find the correct points.


Then, use Curve » Division » Divide to divide the lines. If your surfaces are not planar and extruded in a single dimension, the length of each curve will vary and therefore the distance between points as well. However, the number of points should be the same everywhere, to be controlled with a Number Slider. This determines how many surfaces you will place in between the two original surfaces.


Flatten the points inside the A and B inputs
Simplify Tree
Flip Matrix and use Tree Branch to display Data Structure

Three-Dimensional Data Tree

The data collection of points on the surfaces is a two-dimensional data-structure, organized by the number of U and V. The lines draw between the two surfaces also follow the same structure, comparable to the x and y in the Cartesian coordinate system. When we divide these lines, we introduce another dimension in the data-structure, comparable to the z in the Cartesian coordinate system. Now we have a three-dimensional data-tree.


You can also see this when you double-click the Params » Util » Param Viewer. Here you see that the tree has 3 dimensions, indicated by a center and 2 surrounding rings. In contrast, a two-dimensional data-tree has a center and 1 surrounding ring.


Usually we try to avoid three-dimensional data trees because it is incredibly difficult to work with. To do this, we can flatten the points from the original tree. Right-click the A and B inputs on the Line component and select Flatten. Now we got rid of the first dimension of the data-tree.


For visual purposes, we simplify the tree, using Sets » Tree » Simplify Tree The Simplify Tree option eliminates any overlapping shared branches . The result is a simplified data tree structure.


To understand the data structure we can visualize it with the Sets » Tree » Tree Branch component. If you select the first (0) branch you will see a set of points along a line from surface to surface (this was the third dimension of the data tree, or comparable to the z-direction of Cartesian coordinate system).


The surfaces we would like to create run in the opposite direction of the data tree as it is currently. To obtain this, we can use Sets » Tree » Flip Matrix. Now, checking the first (0) branch again, you'll see that the data tree is grouped by original U and V values, per surface. This is exactly what we need to create a Surface from Points.

You can proceed without fully understanding this as the concept of Three-Dimensional Data Trees is ADVANCED. For more information visit Grasshopper Data Tree Editing

Surface from Points

Difference between U-segments and U-points

Next we use the Surface » Freeform » Surface from Points to create surfaces from the 3D grid of points. Here we need to again identify the U. Note the difference in description of the U: on the Surface from Points component the U specifies the number of points in the {u} direction whereas on the Divide Surface component the U specifies the number of segments in the {u} direction. For us it is important that the defined U (for the Surface from Points component) matches the number of segments in the U direction specified. This is always U +1.


In the example on the right, you see that the U-segments (green dots) is defined as 7 (0-6), resulting in 8 (0-7) U-points (red dots).


How to enter an expression

Therefore, we add an expression to the U input on the Surface from Points component. Right-click the U and select Expression. Enter x+1. The x recognizes any numeric input. If you enter u+1 it won't work! As you increase the original U value, there will always be added 1 to this for the Surface from Points component.


Final result Surfaces from Points
Now plug in the Flipped Data Matrix into the Grid of Points of the Surface from Points component. A number of surfaces will be formed through your 3D grid of points.
Personal tools
Actions
Navigation
Tools