Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.transform (procNode)

A shape moved, turned and resized, by reading it at the point mapped back through the transform. 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 being placed.
  • translate (Vec3, default (0, 0, 0)): How far the shape moves in metres, applied last, after the rotation and the scale.
  • rotate (Vec3, default (0, 0, 0)): Rotation in degrees about the x, then y, then z axis, applied around the origin before the translation.
  • scale (Vec3, default (1, 1, 1)): How much the shape grows along each of its own axes, applied first. Equal components keep the distance exact; unequal ones make it an under-estimate. A component at or below 0 is refused.

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 shape is read at (R^T (P - translate)) / scale and its distance multiplied by the smallest scale component. The bounds are the box around the eight transformed corners of the input bounds; an unbounded input stays unbounded.

Example

local placed = g.sdf.transform({ sdf = g.sdf.box({ size = vector.create(1, 0.2, 0.2) }), rotate = vector.create(0, 0, 45), translate = vector.create(0, 1, 0) })
local mesh = g.sdf.mesh({ sdf = placed, resolution = 16 }).geometry