Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.split_axis (procNode)

A vector split into its coordinate along an axis and the two across it, in cyclic order. The axis-generic shapes (sdf.capsule, sdf.cone, sdf.cylinder, sdf.torus) and warps (sdf.twist, sdf.bend, sdf.taper) are written once with it; sdf.join_axis puts the parts back together.

Inputs

  • axis (String, default "y"): Which axis the first coordinate is read along: "x", "y" or "z". The other two follow in cyclic order: x gives y then z, y gives z then x, z gives x then y.
  • value (Field<Vec3> | Vec3): The vector split.

Outputs

  • along: the coordinate on axis.
  • u: the first perpendicular coordinate.
  • v: the second perpendicular coordinate.

A call answers the three as a record by output name, each a Float, or a Float field when value is a field.

Example

local parts = g.sdf.split_axis({ axis = "y", value = vector.create(1, 2, 3) })
-- parts.along is 2, parts.u is 3, parts.v is 1