Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.torus (procNode)

A ring with a round tube, lying in the plane perpendicular to an axis, 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

  • major_radius (Float, default 1.0): The radius of the ring, measured to the middle of the tube. Takes a value above 0.
  • minor_radius (Float, default 0.25): The radius of the tube. Below major_radius the torus has a hole through it.
  • axis (String, default "y"): The axis the ring turns around: "x", "y" or "z". With "y" the ring lies flat in the XZ plane.
  • center (Vec3, default (0, 0, 0)): The centre of the ring.

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.torus({ major_radius = 1, minor_radius = 0.25 })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 24 }).geometry