Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

core.raster.cells (procNode)

Name the cells of a raster as a flat run, x fastest then z: the position of each cell's centre, and the place in a layer's tiled storage that holds it, optionally at an offset of whole cells.

Built from g.element.id and math operators over the raster's layout members. Every node that reads or writes a layer cell by cell calls it.

Inputs

  • raster (Raster). The raster whose cells are named.
  • dx (Number). Default 0. Cells along x the stored place is offset by; the read is held to the edge of the field.
  • dz (Number). Default 0. Cells along z the stored place is offset by.
  • held (Bool). Default false. Name every cell the tiles hold rather than the cells of the field: heldX cells across and heldZ down, the run starting apron cells before the field's first cell. An offset is then held to the edge of what the tiles hold.

Outputs

  • count: the cells of the field, cellsX times cellsZ; with held, heldX times heldZ.
  • position: a Vec3 field: the world position of each cell's centre (a cell past the field has the position it has in the field's grid).
  • index: an Int field: the place in a layer's stored column that holds each cell, offset by dx, dz and held to the field (or to what the tiles hold, with held). A cell past the field is addressed in the border tile beside it.

Example

local raster = g.core.raster.new({ size = { x = 8, z = 8 }, resolution = 1, layers = { "height" } })
local cells = g.core.raster.cells({ raster = raster })

cells.count is 64; cells.position and cells.index are fields over those cells.