Log inGet started
Package

interpolate.procNode

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

core.interpolate (procNode)

Carry a geometry's attributes to sample points: point and vertex values blended by the barycentric weights, primitive values taken from the sample's primitive, values that cannot blend taken from the nearest corner.

Built from gather at the sample's corners and math operators for the blend, over the names geometry.names[class] lists for each class. A column of floats blends by bary; a column of integers takes the corner with the largest weight.

Inputs

  • geometry (Geometry). The geometry sampled.
  • samples (Points). The samples: points with prim, ia, ib, ic (corner vertices) and bary (their weights), as core.sample.surface and core.sample_curve make them.

Outputs

  • points: the samples with the geometry's attributes.

Example

local grid = g.mesh.grid({ size = { x = 2, z = 2 }, cells = { x = 2, z = 2 } })
local numbered = g.attribute.number({ geometry = grid, class = "point", name = "n" })
local warm = g.attribute.set({ geometry = numbered, name = "heat", value = g.element.id * 1.0 })
local samples = g.core.sample.surface({ geometry = warm, count = 4, seed = 2 })
local carried = g.core.interpolate({ geometry = warm, samples = samples })

Each sample carries heat blended from the corners of the triangle it lies on, and n, a whole number, from the corner with the largest weight.