3.1. Algorithms and Data Types
Algorithms and Data Types in Grasshopper
Structure of an Algorithm
An algorithm are series of intructions that are followed, in steps, to solve a problem.
Example in Grasshopper:
Common Data Types
In Computer Science and Computer Programming, a Data Type or simply Type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data.
The most commonly used Data Types in Grasshopper are:
- Strings
- Numbers
- Booleans
String
A string represent text.
Numbers
The most commonly used number Data Types in Grasshopper are:
- Integers
- Float
Integers
Are whole numbers that range from -2,147,483,647 to 2,147,483,647 (up to 10 digits of precision):
Floats
Represent values as high-precision fractional values:
Booleans
Booleans can represent only two different values:
- True (1)
- False (0).
Geometry Data Types
Some of the most common geometry Data Types are points and lines, but you can also find circles, planes, boxes…etc:
Point
Line
Circle
Plane
Contains a collection of 3D axis-systems, in this case an origin and a Z vector:
etc…
Computer Graphics Types
The computer graphics contains two main types:
- Raster (Bitmap) graphics
- Vector graphics