fitIsoGrid

A W×H grid of square cells holding about count agents at the canvas aspect, each side clamped to [min, max].

fitIsoGrid(
  count: number,
  aspect: number,
  min: number,
  max: number,
): { w: number; h: number; }

Import sim from shaders/std and use sim.agentFrame.fitIsoGrid.

Parameters

NameTypeNotes
countnumber
aspectnumber
minnumber
maxnumber

Example

const {w, h} = agentFrame.fitIsoGrid(count, aspect, 8, 160)

See also

  • 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.