# Math Inspired Geometry in Grasshopper

## Introduction

making geometry with mathematics
making the correct geometry
digging out the object

This page showcases some Grasshopper definitions that we created that use maths to generate geometry.This is a very powerful tool for form exploration. Due to the mathematical setup of your geometry you will be able to manipulate the geometry not directly by interacting with the geometry but by altering the variables of the mathematical definition. This strategy is also applied in computational design where the relations of constraints and goals of the designs are mathematically defined. In that case the alterations of the values regarding goals and constraint will generate a form which is influenced by these goals and constraints. The results can be often unpredictable due to the complexity of the relationships and the mathematical calculations which have to to take place to generate the form. This form can be viewed as schematic representation of the relationships between goals and constraints or can define the start of the actual form of the building.

The geometry you will create will be defined by its aesthetics and the possibility to be 3D printed ( which is a constraint). The constraints are:

• maximum volume is 4 cm3 . Any higher and the object will not be printed.
• minimum thickness of free standing part is 3 mm. To be on the save side keep 5 mm as minimum. 3mm can be to fragile when the part is excavated from the powder.
• the geometry should be defined as a solid and has to be closed.

### Source Files

The Grasshopper Definitions of many of the examples, along with some additional snippets that might be useful, are available for download on the TOI Website: Math inspired geometry Grasshopper Definitions (ZIP).

For this workshop you will create a 3D model which will be printed in the 3D. We made a series of grasshopper files which can help you to support to make the 3D model. You can select one option for generating your model. There are two main options.

• the generation of a pattern made from a set of curves. The result is a 2D object which can be made into 3D with the traditional modelling tools like Loft, Sweep1 rail, Extrude and Planar or Curve Network.
• the generation of a 3D object which is based on a Mobius curve. This option has 3 variants. In this case the 3D form will be generated by the Grasshopper definition. You can select one of these variants.

## Workshop Option 1 - Generation of 2D Tilings as a basis of a 3D Model

Inspired on work done by MC Escher, we've created a Grasshopper definition that can be used to create any quadrilateral 2D tiling. The definition can also map this to an arbitrary surface.

The definition 2D_quadriliteral_tiling.gh and accompanying Rhino file takes four points in the XY-plane that you should create in Rhino. You can move them around, but you should keep them in the right order, either clockwise or counter-clockwise. Using the sliders you can set the amount of repetitions for the tile that is created. This pattern can then be mapped to an arbitrary surface.

The definition can generate a tiling with straight edges, or use 4 curves that are mirrored on the sides to allow for proper tiling. The curves you specify are automatically scaled, positioned and mirrored on the four edges of the quadrilateral.

The definition 2D patroon_simpel.gh and accompanying Rhino file creates a simple rectangular tiling, which creates a pattern from any set of given curves. These curves can be mapped to a target surface, flat or curved.

You can use various techniques to create 3D geometry from these curves. The definitions are set up to extrude shapes along the curves. You can use these as is, or use them to subtract from a given object, creating grooves/rifles in a surface.

## Workshop Option 2 - Möbius Curve

In these examples we going to use a Mobius curve as basis for the generation of geometry. With the help of Grasshopper we can use points from that curve as a basis for generating complex shapes. These prepared files can be downloaded at the TOi website. They are setup in such a way that you don't have to add anything to the grasshopper definition. Just use the sliders to explore the large amount of variations you can generate with these definitions.

Make a selection of one of these options and generate a volume which can be printed.

#### Variant 1

With option 1 you will generate a tube following the Möbius curve. Please look at the instruction video for further explanation.

#### Variant 2

With option 2 you will generate a shape based on a series of boxes which are located at the points of the Möbius curve. If you change the curve the boxes will follow. The boxes can also be rotated to generate additional options in form generation. Each box will be the same size. Please look at the instruction video for further explanation.

#### Variant 3

With option 3 you will generate a shape based on a series of boxes which are located between the points of the Möbius curve. If you change the curve the boxes will follow. Each box will have a different size. Please look at the instruction video for further explanation.

## Other Curve Craziness

The Möbius curve is only one example of how you can construct curves using math. The ZIP-file with examples (see top of this article) has other Grasshopper Definitions that you can use to generate curves using formula.

• create_curve_by_math_function_and_various_snippets.gh: Basic setup to construct a curve using a formula for X, Y and Z positions. Also features snippets to place planes, re-orient planes, use random values, rotate objects around an axis.
• curves_connect_pipe_using_parameter_values_and_graph_mapper: Two curves that are divided. Both sets of points are connected using curves. Along these curves a pipe is constructed. The snippet features a Graph Mapper that is used to change the pipe diameter based on the position on the curve.
• Fibonacci.gh: Fibonacci formula
• helix_with_distortions.gh: formula to create a helix. Also features an option to distort this helix using random values.
• sweep_along_curve.gh: How to sweep (extrude) a profile curve along a set of rail curves.

## From Curves to 3D Objects

When you have one or more curves, there are several ways you could generate 3D objects from these curves.

Of course you have the obvious ones, such as loft, extrude, planar and edge curve surface. But there are more options that may be worth while exploring:

### Extruding a profile along a curve

Sweep a profile along a curve covers how you can sweep (or extrude) an arbitrary curve along curves.

### Using points on several curves to generate solids

These scenarios assume you have (at least) two separate curves with an equal amount of points on each of them.

#### Using curves

Connect the points on both curves using a line, arc or curve. Use these curves to create a Pipe, or Sweep (see above).

Example of creating pipes with variable diameter based on the curve parameter and a graph mapping function

This example shows how to connect points on two curves, using them to create pipes. But of course you could also use Sweep to create other shapes (See: Sweep a profile along a curve). This sexample uses the Parameter value of the points on the curve to generate a value for the pipe radius, using a Graph Mapper. The Domain is used to translate the range of output values from Graph Mapper (0-1) to a configurable minimum and maximum, using Remap Numbers.

#### Using Planes

Example of constructing Cones on planes that are placed on one curve, oriented to the corresponding point on another curve

Create a Vector » Vector » Vector 2Pt between two sets of points on either curve. Use the points on one curve to create Vector » Plane » Plane Normal planes together with the vectors you've created. Use the Vector » Vector » Vector Length component to find the distance between both points, if you need that to determine the size of the object you're creating. Use any of the Surface » Primitive components that create primitives based on planes.

If you've used the Curve » Division » Divide Curve component to create the points on curve, you also have the direction of the curve in each point availaable in the Tangents output. you can use that to orient the plane or object in a direction that follows either curve.

You may also find the Parameter (t) output useful. It contains the relative position of the point on the curve. If you Reparameterize the input Curve (RMB-click on the Curve input of Divide Curve), it's a number between 0 and 1. You can use that in a formula to, for instance, change the size of the objects you're creating.

## 3D Solids Checking

IF you generate 3D objects using one of the methods above, you need to make sure it can be printed if you're doing the week 5 Workshop of BK3OV3. In most cases it suffices to use Surface » Util » Cap Holes or Surface » Util » Cap Holes Ex to close pipes, sweeps and such.

To make sure objects are valid solids, bake the geometry in Grasshopper to Rhino objects and check them in Rhino.

### Object Properties

Closed Polysurface means the object is a solid
Open Polysurface means it is not a solid

The object Properties Panel shows details for selected objects. If Type is Closed Polysurface, the object is a proper solid. If Type is Open Polysurface, it means there is still a hole in it that needs to be closed

To find where your object is still open, you can look for Naked Edges.

### Finding Naked Edges

Select your object and use Analyze » Edge Tools » Show Edges in Rhino to show edge analysis.

Select Naked Edges. Naked edges are highlighted:

### Volume and Center of Mass

If you've baked geometry from Grasshopper to Rhino and changed it, you may want to re-check the volume. Use Analyse » Mass Properties » Volume to determine the current volume.

You can use Analyse » Mass Properties » Volume Centroid to check the center of mass. The function creates a Rhino Point at the current center of mass. This can be useful if you want to make a base for your object. As long as the center of mass is above your base, it should be more or less stable.