# Grasshopper Points

## Introduction

**LEVEL: INTRODUCTORY**

There is a logical order in the layout of the Tabs. The first type of geometry we encounter when we go from the left to the right will be the points. These points can be used for a variety of tasks. They can be made by :

- Defining them in Rhino and selecting them for a Point Parameter.
- Making a point or points in Grasshopper when a Point Parameter is selected.
- Making a point or points by defining the x, y and z value of a Point Component which can be selected in the Vector Tabs.
- Extracting a point or points from a 1 dimensional object like a curve
- Extracting a point or points from a 2 dimensional object like a surface

The point in Grasshopper has multiple functions.

- The point or points as a location
- The point or points as a direction
- The point or points as a basis for 1 dimensional objects like curves, polylines etc
- The point or points as a basis for 2 dimensional objects,surfaces
- The point or points as a basis for complex geometric relations.

## Creating a point

The world coordinate system is a 3 dimensional space and therefore we can define for a point 3 values. The x,y and z coordinates. A point defines a location in world space. Points can be made in many different ways.

### Point as parameter

We can use a parameter to create a point in Grasshopper. This option however also requires the definition of a point or points in Rhino. The parameter will only contain the data of the location of the point in world space. If the location of the point is changed in Rhino the parameter will be updated with the new location. The parameter enables you to define the point or points in the Rhino viewport. The input is therefore defined by where the cursor is clicked within the viewport. If the point is defined in Rhino and then selected for the Parameter, the points can still be moved within Rhino.

### Point as vector

The point however also can be numerically defined in Grasshopper by connecting a numerical input to the action of creating a point or points. In the Vector tab we can find the Point option. This Point component has three inputs, one for every axis. These can be simply defined by typing them in or attaching either a number slider or a single number primitive. These values can be changed at any time. The alteration of the position of the point will cause re-calculation of the point and its relations in whole Grasshopper network. When the point is created in this manner, it cannot be moved in Rhino.

## Creating multiple points

The parameter can contain more than 1 point. If multiple points are selected in Rhino or generated in Grasshopper the parameter will contain them all. In that case the parameter will represent multiple locations in world space. Any action of a component will use the multiple points as input. The result is multiple actions on the same object. This property of using multiple inputs for a single action of a component is one of the more powerful tools within Grasshopper. It enables you to copy complex commands to a variety of objects.

For example: If multiple points are defined in Rhino and put in a point parameter, the parameter will contain multiple locations. When an object, a circle, has to be created, it needs a centre point, a radius and a plane on which it will be aligned. We can use the point parameter as input for the centre point. However because we have defined multiple points multiple circles will be created as a result. The action of creating a circle will applied to every point in the list of the parameter.

If the point is defined as a component, the input of the x, y and z coordinates have to be numerically defined. It is possible to define more than 1 number for each axis. Multiple numbers can be manually defined in the input menu of the component. The result is a list of multiple points.

## Input lists

If the amount of input is increased for multiple channels the output will differ depending on the how the lists of the various channels are combined. There are three options for combining lists of the multiple inputs. These options can be accessed by right clicking the name of the component, making the settings menu appear.

The first method of combining the input lists is the "short list". In this case the shortest list of the inputs will dictate how the output list is formed. It will take the shortest list and combine it with the other input lists. If the shortest list contains only one number, the output list will also contain one item, as can be seen in the first example. The rest of the input numbers will remain unused.

The second method, "longest list", is the standard setting. In the case of the example we have three lists. The X input list with six numbers, the Y input list with eleven numbers and list Z with one number defined. With the longest list option, the output list will contain the same number of items as the maximum size of list of the input, in this case eleven numbers. The lists are combined by taking all first numbers of the list and combining them. Then all second numbers, and so on. If one of the lists doesn't contain a second (or third, fourth, etc.) number, it will use the last available number. This happens in the case of list Z, making the Z value for all points 0.0. The same happens for the seventh point and further. List X doesn't contain seven numbers so it will use the last number of the list which has a value of 10.0.

The third method of combining the input lists is the "cross reference". In this case all numbers of the lists are connected to each other. So every number in list X will connect to every number of list Y and Z creating a network of connections. **This option can be used for creating point grids**.

## Sets of numbers for input

It is possible to manually input every x, y and z coordinate. However it can be more efficient to use a sequence of values as an input. In the Sets Tab we find various options to generate sets of values. The Sets tab contains the functions for manipulating and generating lists. There are three main types of sequences available for generating a set of values.

The first is the Range. The Range component enables the user to define a range of values with a first and last number, and the number of steps. A large number of values can be defined without having to manually type them in the list. The Range option can be effectively used when the domain is known and has to be subdivided.

The second is the Series. The Series will enable you to define the starting value, the stepsize and the number of steps. The series can be effectively used when the start value is known and the number and size of the steps. In this case the domain is defined not by a value input but by the result of the start value, size of steps and number of steps.

The third is the Random option. With the Random component a random set of values is generated. The minimum and maximum value, the number of values and the seed can be defined within the component.

It is of course also possible to combine the Range and Series components to generate more than one domain. This will result in a set of points defined by multiple domains. However, because we only defined the ending value of the domain, the resulting domains start all at 0.0. This results in an overlap of grids as can be seen in the image.

With the range option it is difficult to generate multiple non overlapping domains. The combination of two Serie components however can generate domains without overlap because you can define the first value of the domain. By defining the size of the domain smaller than the first value of the next domain a series of non overlapping grids are defined.

The input data structure consists in this case of 4 domains with 4 values. Because they are cross referenced the output data structure consists of 4 domains with 16 values. This results in a data tree structure with 4 branches (the domains) and on each branch 16 values.

## Mathematical definition of the value input

The input of the series and range can be, like any other component, manually defined. The components however also support the input of a variety of mathematically defined components. These can vary in complexity; from a simple sinusoid to the more complex mathematical description of the Möbius curve. The input data is mathematically redefined and offered as output.

The mathematical description can vary not only in content but also in number of variables. There are several options available. The mathematical description can be defined with 1 or more variables. However there is also the option to extend beyond the embedded options of Grasshopper by scripting in Visual Basic, Python or C#. These options will be discussed later in this wiki.

Simple shapes like a circle or a helix can be mathematically defined. A circle can be defined as f(x) = sin(t) and f(y) = cos(t) where t is within the range of 2π. A simple use of the function component will make it possible to draw a circle based on these formulas. The range of 2π is defined by multiplying the range of 0 to 1 with 2π. The cos for the X input and sin for the Y input will generate a circle. A helix can then easily be made by coupling the range to the Z value of the point component.

A well known curve is the Mobius strip. This curve can also be generated by using the function option in Grasshopper.

- x=sin(x)*(-2+y*sin(x/2))
- y=cos(x)*(-2+y*sin(x/2))
- z=y*cos(x/2)