3.3. Basic operations

Basic arithmetic operations in Grasshopper

Points

A point is a list of one or more values that are called coordinates.

Points and Vectors are the base in order to build geometry in Grasshopper.

There are different ways how you can create a point:

  • Primitive > Geometry > Point
Points
  • Vector > Point > Construct Point
Points

Series

We can create series of numbers in Grasshopper in different ways:

  • Sets > Sequence > Series
Series
  • Sets > Sequence > Range
Series Series

Operators

Operators in Grasshopper can be found under Math > Operators, and are used to perform arithmetic operations on numbers.

Operators

Addition

  • Math > Operators > Addition
Addition

Subtract

  • Math > Operators > Subtraction
Subtract

Multiplication

  • Math > Operators > Multiplication
Multiplication

Division

  • Math > Operators > Division
Division Division

Modulus

Divides two numbers and returns only the remainder. The division of 9 by 3 returns 0 as a reminder:

  • Math > Operators > Modulus
Modulus

The division of 9 by 4 returns 1 as a reminder, since we can contain two times 4 and still have 1 left:

Modulus

Power

  • Math > Operators > Power
Power

Constants

In Grasshopper we can find certain Build-in components with the values of Pi, Natural Logarithm (e) and Golden Ratio:

Constants

Comparison operators

Comparison operators are used to compare values.

They return Boolean values based on whether a comparison is True or False.

  • Maths > Operators

Booleans

Boleans variables can only store two values:

  • TRUE (1)
  • FALSE (0)
Comparators

Boolean Toggle allows you to quickly change between single True or False values:

Comparators

Grasshopper has components to test conditions and output Boolean values:

Comparators

Check if a number is contained inside a certain Domain:

  • Maths > Domains > Includes
Comparators

Logical operators

Logical operators mostly work with Booleans.

Gate NOT performs boolean negations.

  • Maths > Operators > Gate NOT
Comparators

AND and OR components takes two arguments as input. Logical operators are used to evaluate something.

  • Maths > Operators > Gate AND
Comparators

Different combinations:

  • Maths > Operators > Gate OR
Comparators

Functions

The series of numbers can be easily manipulated with mathematical operators:

Math Functions

At the same time we can combine them with trigonometrical operations, as for example Sine, Cosine… etc:

  • Maths > Trig > Sine
Math Functions
  • Maths > Polynomials > Square
Math Functions
  • Maths > Trig > Sine & Cosine
Math Functions

Grasshopper offers you “Ready to use” components or custom made ones to create your functions:

  • Math > Script > Expression
Math Functions

And by using different parametric functions we will be able to reproduce geometries such as circles, spirals… etc.

Example 1 - Circle: Math Functions

Example 2 - Spiral 2D: Math Functions

Example 3 - Helicoid: Math Functions

Knowledge Checks