Log inGet started
Package

twist.procNode

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

sdf.twist (procNode)

The space twisted around an axis in proportion to the position along it, so a column becomes a helix. 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 twisted space is read in.
  • angle (Float, default 90.0): How far the space turns, in degrees per metre travelled along axis. Negative turns the other way; 0 leaves the shape alone.
  • axis (String, default "y"): The axis the space turns about, and the one whose coordinate drives how far it turns: "x", "y" or "z".
  • center (Vec3, default (0, 0, 0)): The point the twist is measured from: the axis passes through it, and the twist is zero there.

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

A twist bends distances, so the field is an approximation that grows less exact as angle rises. The bounds keep the shape's extent along axis and sweep the other two out to its furthest corner.

Example

local column = g.sdf.box({ size = vector.create(0.4, 2, 0.4) })
local helix = g.sdf.twist({ sdf = column, angle = 90, axis = "y" })
local mesh = g.sdf.mesh({ sdf = helix, resolution = 32 }).geometry