Grasshopper Grid Components¶
The grid components in Grasshopper are a little different from what we’re talking about
here. They can all be found under the Vector > Grid dropdown. Each of these components
have two outputs: Cells
and Points
.
The biggest difference between the grid components and the vector-based grids we’re talking about is that the vector-based grids are generated as linear combinations of basis vectors, but the Grasshopper component grids are generated by tiling the geometry that connects the grid points (i.e.: the grid cells).
Square¶
Corresponding Basis
The Square grid component creates a grid tiled by squares. Points
at {0;0;A}(B)
is the point given by:
Cells
at {0;0;A}(B)
is the square with Points
at {0;0;A}(B)
at its bottom-left
corner. As such, there is one less path in the Cells
tree, and each list contains
one fewer item than the Points
tree.
Rectangular¶
Corresponding Basis
Rectangular is functionally the same as Square, but with different basis vectors.
Hexagonal¶
Corresponding Basis
The Hexagonal grid component creates a tiling of hexagons. Points
at {0;0;A}(B)
is given by:
These points form the corners of a triangular grid. Cells
at {0;0;A}(B)
is the
hexagon centered at the point at Points
at {0;0;A}(B)
.
Triangular¶
Corresponding Basis
In this case, \(\mathbf{origin}\) is the centroid of Cells
at {0;0;0}(0)
.
All points in Points
are shifted by this vector.
Triangular is slightly different because Points
corresponds to the centroids of
each triangular grid cell. As such, not all grid points generated as linear combinations
of \(\mathbf{u}\) and \(\mathbf{v}\) will be present in Points
. Instead,
Points
at {0;0;A}(B)
is given by:
This is quite a weird setup, but it’s how you could convert from the basis above
to the points given by Points
. These points form the corners of a hexagonal grid.
Cells
at {0;0;A}(B)
is the triangle centered at Points
at {0;0;A}(B)
.
Some of these will be “pointing down”, while others will be “pointed up”.
Radial¶
Corresponding Basis
\(\mathbf{origin}\) in this case is set up such that the first point
in each path of Points
will be vertical, and iteration over the list
at that path sweeps clockwise.
Radial is another weird one, where grid points are instead computed in radial coordinates. Points in the grid can still be calculated as linear combinations of the basis vectors (\(\mathbf{r}\) and \(\mathbf{p}\) in the case of polar coordinates), with the first component of the point being the radius and the second being the angle.
Points
at {0;0;A}(B)
is given by:
Cells
at {0;0;A}(B)
is the grid cell with corners given by Points
at
{0;0;A}(B)
, {0;0;A}(B + 1)
, {0;0;A + 1}(B + 1)
, and {0;0;A + 1}(B)
.
Use Cases¶
The Square, Rectangular, and Radial components are very useful if you need an array of cells
and their corners on demand with minimal effort. The Points
provided by Hexagonal
and Triangular though aren’t as useful as the Cells
themselves because you can get
the centroid of a polyline with the Area component.
Considering you can recreate each of these grids with Python manually, the best use-case for these existing components is convenience, particularly when you want the polyline cells they provide.