Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

grid.box (procNode)

A grid of cells filling a box: a Grid with one point at the centre of every cell, laid out x fastest, then y, then z, and no channels yet. The cell centres are min + (coords + 0.5) * cellSide, computed on the device from each point's number, and the layout (cells, min, max) is stored on the detail as grid, which is what makes the value a Grid. A grid one cell thick on an axis is flat across it; an axis of no extent is given a thickness of 0.001 so a position on the plane falls inside it.

Built from: core.points, math.*, vector.*.

Inputs

  • center (Vec3, default (0, 0, 0)). The centre of the box the cells fill.
  • size (Vec3, default (1, 1, 1)). The box's extent along each axis.
  • cells (Vec3, default (16, 16, 16)). How many cells along each axis, whole numbers of at least 1; while cellSize is 0 anything else is refused. One cell on an axis makes the grid flat across it.
  • cellSize (Float, default 0, at least 0). The side of a cell. Above 0 it decides how many cells fit along each axis instead of cells: the count is size over it rounded up (at least 1), and the box grows about center to that whole number of cells.

Outputs

  • grid (Grid). The cell centres as points, cells.x * cells.y * cells.z of them, with detail.grid = { cells, min, max }.
local air = g.grid.box({ size = vector.create(4, 3, 4), cells = vector.create(32, 24, 32) })