Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

field.vortex

A vortex: a Vec3 field turning around an axis through center, counter-clockwise looking down the axis, strongest near the axis and falling to half at radius from it (1 / (1 + (d / radius)^2)). Zero on the axis. A zero-length axis reads as +Y.

Inputs

  • position (Field<Vec3> | Vec3, optional). Where each element samples the field. Left unwired, it is the position leaf g.element.P of the element the field is evaluated at, which field.substitute replaces.
  • center (Vec3). Default { x = 0, y = 0, z = 0 }. A point the axis passes through.
  • axis (Vec3). Default { x = 0, y = 1, z = 0 }. The axis the field turns around; the turn is counter-clockwise looking down it.
  • strength (Float). Default 1. Speed of the turn at the axis. Negative turns the other way.
  • radius (Float). Default 1. The distance from the axis at which the turn has fallen to half.

Outputs

  • field: a Vec3 field.

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local out = g.attribute.set({ geometry = points, name = "v", value = g.field.vortex({ center = vector.create(0, 0, 0), axis = vector.create(0, 1, 0), strength = 1, radius = 2 }) })