Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

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.box makes a grid filling a box, by cell count or by cell size.
  • grid.cell_index answers which cell each position falls in; grid.neighbor_index the cell a fixed step from each cell, so gathering a channel through it shifts the channel by that step.
  • grid.sample reads 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" })