Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

attribute.carry (procNode)

Move every column of one class through an index map: element i of the result takes element index[i] of the source; an index naming no element reads zeros.

Built from the gather kernel, run once for each column the class holds (core.names lists them, the structure columns and stored numbers such as id, N and uv included), then geometry[class].count is set to the result length. The result length is size when it is given and the length of index when it is left out.

Inputs

  • geometry (Geometry). The geometry whose columns move.
  • class (one of point, vertex, primitive). Default "point". The class whose columns are moved.
  • index (Column<Int>). For each element of the result, the source element it takes.
  • size (Number, optional). How many elements the result holds; left out, the length of index. An index that is a field over the result's elements needs it stated.

Outputs

  • geometry: the geometry whose class holds every column moved through index, counted by the result length. The other classes come through as they were.

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local moved = g.attribute.carry({ geometry = points, class = "point", index = g.core.column({ values = { 3, 0 } }) })

moved holds two points, the fourth and the first. With a field as the index the length is stated: g.attribute.carry({ geometry = points, index = g.element.id * 2, size = 2 }) keeps the first and the third.