Builtin Library
README.md
sdf.taper (procNode)
The space tapered along an axis: the cross-section is scaled linearly between two ends, so a cylinder becomes a cone. A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.
Inputs
sdf(Sdf): The shape the tapered space is read in.start_scale(Float, default 1.0): How much the cross-section is scaled at thefromend. Takes a value above 0.end_scale(Float, default 0.5): How much the cross-section is scaled at thetoend. Takes a value above 0; a taper to exactly 0 leaves no cross-section to measure in, so a true point is sdf.cone.axis(String, default "y"): The axis the taper runs along: "x", "y" or "z". The two perpendicular axes are the ones scaled.from(Float, default -0.5): The coordinate alongaxis, in metres, at which the scale isstart_scale.to(Float, default 0.5): The coordinate alongaxis, in metres, at which the scale isend_scale. Equal tofrom, the whole shape takesend_scale.
Outputs
sdf(Sdf): the shape, a record offield(the signed distance at each point of space, negative inside) andbounds({ min, max }, the box the shape stays inside).
Between from and to the scale runs linearly; beyond them it holds the end's value. The distance is multiplied by the smaller scale (at most 1), which keeps it a safe under-estimate.
Example
local post = g.sdf.cylinder({ radius = 0.4, height = 1 })
local tapered = g.sdf.taper({ sdf = post, start_scale = 1, end_scale = 0.5, axis = "y", from = -0.5, to = 0.5 })
local mesh = g.sdf.mesh({ sdf = tapered, resolution = 16 }).geometry