Builtin Library
README.md
sdf.capsule (procNode)
A cylinder capped with a hemisphere at each end, as an exact signed distance field. A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.
Inputs
radius(Float, default 0.25): The tube's radius, and the radius of each cap. Takes a value above 0.height(Float, default 1.0): The distance between the centres of the two caps. At 0 the capsule is a sphere. The full length alongaxisis this plus twice the radius.axis(String, default "y"): Which world axis the capsule runs along: "x", "y" or "z".center(Vec3, default (0, 0, 0)): Where the capsule sits; it reaches halfheightplusradiuseither side of it alongaxis.
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).
Example
local shape = g.sdf.capsule({ radius = 0.25, height = 1, axis = "y" })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry