Overview
Module Geometry.Grids contains a bunch of functions for working with grid representations. These grids are uniform, meaning all rows have the same number of columns. Much like a spreadsheet.
ixfx’s grids aren’t associated with data or visual representation. It’s a way of working with a logical grid.
The type of a Grid is:
And continuing the similarity with spreadsheets, each position in the grid is a GridCell, made up of an integer x and y value.
Below is a demo to play with some of the grid features.
- Visit: Traverse through each cell according to some logic
- Offset: Calculate an offset from a cell position. Includes logic for how to wrap at the grid boundary. In the demo, checking ‘Cardinals’ produces cell position for all cardinal directions.
- Line: Using a start and end cell, calculate all the cells connecting them in a straight line
Grids
Practical uses
Grids are useful for:
- Image processing & generation (see Module Visual.ImageDataGrid )
- Wayfinding for agents in games
- Flow-field simulations
- …and much else.
In the demo below a grid is used to lay things out on a canvas