Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.bend (procNode)

The space bent about one axis in proportion to the position along another, so a straight bar curls into an arc. 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 bent space is read in.
  • angle (Float, default 45.0): How far the space turns, in degrees per metre travelled along along.
  • axis (String, default "z"): The axis the space turns about: "x", "y" or "z". The bend happens in the plane perpendicular to it.
  • along (String, default "x"): The axis whose coordinate drives how far the space has turned: "x", "y" or "z". It differs from axis; the same axis in both is refused, and sdf.twist is that case.
  • center (Vec3, default (0, 0, 0)): The point the bend pivots about: the space is unchanged there and curves further away from it.

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 are the cube around center reaching the shape's furthest bound corner.

Example

local bar = g.sdf.box({ size = vector.create(2, 0.2, 0.2) })
local arc = g.sdf.bend({ sdf = bar, angle = 45, axis = "z", along = "x" })
local mesh = g.sdf.mesh({ sdf = arc, resolution = 32 }).geometry