Log inGet started
Package

sdf.nodebox

Newest version

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

README.md

sdf.mirror (procNode)

The space mirrored across planes through a centre, so half a shape becomes a symmetric whole. 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 whose positive side is mirrored. Anything of it on the negative side of a mirrored axis is replaced by the mirrored copy.
  • axes (String, default "x"): Which axes are mirrored, as a run of axis letters: "x", "y", "z", "xy", "xz", "yz" or "xyz". "x" reflects left to right, "xz" gives four-fold symmetry about the vertical, "xyz" all eight octants.
  • center (Vec3, default (0, 0, 0)): Where the mirror planes cross.

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 point is read at its absolute offset from center on each mirrored axis. On a mirrored axis the bounds become symmetric about center, reaching as far as the shape's furthest bound on that axis.

Example

local half = g.sdf.sphere({ radius = 0.3, center = vector.create(0.5, 0, 0) })
local pair = g.sdf.mirror({ sdf = half, axes = "x" })
local mesh = g.sdf.mesh({ sdf = pair, resolution = 16 }).geometry