Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.elongate (procNode)

A shape pulled apart along each axis, the gap filled with a straight extrusion of its middle: a sphere becomes a capsule or a rounded slab. 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 being pulled open.
  • extent (Vec3, default (0, 0, 0)): How far the shape is pulled open along each axis, in metres, either side of center, so an extent of 1 adds 2 to the total length on that axis. A component of 0 leaves that axis alone; a negative one is read as its magnitude.
  • center (Vec3, default (0, 0, 0)): The point the shape is pulled open around.

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).

The bounds grow by extent on each axis.

Example

local pill = g.sdf.elongate({ sdf = g.sdf.sphere({ radius = 0.3 }), extent = vector.create(0.5, 0, 0) })
local mesh = g.sdf.mesh({ sdf = pill, resolution = 16 }).geometry