Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

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 along axis is 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 half height plus radius either side of it along axis.

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

Example

local shape = g.sdf.capsule({ radius = 0.25, height = 1, axis = "y" })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry