fitJitteredGrid
A grid of about count roughly square cells over the canvas plus an overscan border on every side, for agents that rest on a jittered grid.
fitJitteredGrid(
count: number,
domainX: number,
overscan: number,
): { cols: number; cellW: number; cellH: number; }
Import sim from shaders/std and use sim.agentFrame.fitJitteredGrid.
domainX is the canvas width in heights (the aspect).
Returns the column count and the cell size, which field.jitteredGridHome reads.
Parameters
| Name | Type | Notes |
|---|---|---|
count | number | |
domainX | number | |
overscan | number |
Example
const {cols, cellW, cellH} = agentFrame.fitJitteredGrid(count, domainX, 0.1)
See also
fitIsoGrid— A W×H grid of square cells holding aboutcountagents at the canvasaspect, each side clamped to[min, max].field— What a turning agent samples at its position: the magnetic field at the cursor, and its resting place on a jittered grid.