Builtin Library
README.md
grid (nodebox)
Grids: a box of cells as a value (Grid), one point at the centre of every cell, laid out x fastest, then y, then z, with the layout (cells, min, max) on the detail attribute grid. A grid's channels are point attributes written on it (air.point.heat = ...), one value per cell, which simulation, field and SDF nodes read and write.
grid.boxmakes a grid filling a box, by cell count or by cell size.grid.cell_indexanswers which cell each position falls in;grid.neighbor_indexthe cell a fixed step from each cell, so gathering a channel through it shifts the channel by that step.grid.samplereads a channel at every point of a geometry, blended between the eight cell centres around it.
points.grid, points.box, geometry.to_sdf, sdf.sample and texture.cells are built on grid.box; points.from_grid and sdf.from_grid read a grid back as points or as a distance field.
local air = g.grid.box({ size = vector.create(4, 4, 4), cells = vector.create(8, 8, 8) })
air.point.heat = air.point.P.y
local probes = g.grid.sample({ geometry = g.points.grid({ countX = 4, countZ = 4 }), grid = air, name = "heat" })