Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

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 the from end. Takes a value above 0.
  • end_scale (Float, default 0.5): How much the cross-section is scaled at the to end. 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 along axis, in metres, at which the scale is start_scale.
  • to (Float, default 0.5): The coordinate along axis, in metres, at which the scale is end_scale. Equal to from, the whole shape takes end_scale.

Outputs

  • sdf (Sdf): the shape, a record of field (the signed distance at each point of space, negative inside) and bounds ({ 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