gilbert_dimensions
function gilbert_dimensions(n, aspect): [number, number];Defined in: gilbert.ts:231
Picks a width × height grid of at least n cells whose shape is as close
as possible to aspect.
Both dimensions are integers, so only certain shapes exist at a given cell
count and the best one is not always nearest sqrt(n / aspect). A few
heights either side of the ideal are tried, scored on the log ratio so that
twice too wide and twice too tall count equally, with a light penalty for
overshooting n.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
n | number |
aspect | number |
Returns
Section titled “Returns”[number, number]