Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

attribute.transfer

Transfer a point attribute, or every point attribute, from a source geometry to a target by nearest point, on the device. The sources are laid on a spatial grid, and each target reads the cells around it. Of two sources equally near, the one earlier in the source's order gives the value.

Built from core.neighbours in "nearest" mode, then attribute.gather for one named column, or the gather kernel for each point column core.names lists when name is empty.

Inputs

  • geometry (Geometry). What receives the column. A copy carrying the transferred column comes out, with one value per one of its points.
  • source (Geometry). What the column is read from. Each target point takes the value of whichever source point is nearest to it in space; the two need not match in count, spacing or topology.
  • name (String). Default "". Which point column is carried across, read on the source and written on the receiving geometry. Left empty, every point column the source holds is carried under its own name, its position P excepted: the receiving points keep where they stand.
  • as (String). Default "". The name the transferred column is written under. Left empty it is name. Read only with a name.

Outputs

  • geometry: the receiving geometry with the transferred column (or columns) on its points.

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local grid = g.mesh.grid({ size = { x = 2, z = 2 }, cells = { x = 2, z = 2 } })
local hot = g.attribute.set({ geometry = points, name = "heat", value = g.element.id })
local warmed = g.attribute.transfer({ geometry = grid, source = hot, name = "heat" })

Each of the grid's nine points takes heat from the line point nearest it.