Builtin Library
README.md
ramp.sample
A ramp read at every element, at the position along it a 0..1 field names: 0 reads the ramp's first key, 1 its last, and a value past either end reads that end.
The read is one expression of u: the first key's value plus, for each pair of neighbouring keys, the change in value across the pair times how far u has travelled through it (0 below the pair's first key, 1 above its second, and between them the ramp's interpolation: a straight line, eased, or a step at the second key). The ramp's keys are ordered by t when the ramp is made, so keys written in any order read in t order. The expression grows with the key count. u given as a plain number answers a plain value.
Inputs
ramp(Ramp). The ramp to read: whatramp.keysorramp.blackbodyanswers.u(Field<Float> | Float). Where along the ramp each element reads, 0 to 1.
Outputs
field(Field). The ramp's value atuper element: a number for a Float ramp, a vector of the ramp's width otherwise.
local spots = g.points.grid({ countX = 5, countZ = 1, spacing = 0.5 })
local rise = g.ramp.keys({ keys = { { t = 0, value = 0 }, { t = 1, value = 4 } } })
spots.point.h = g.ramp.sample({ ramp = rise, u = spots.point.P.x })