field.nodebox
This package holds more than this page lists. See all of its files in its world.
README.md
field.normal
Each element's normal (Vec3). Wired, the point normals of geometry, computed from its primitives by core.normals.point when it carries none; unwired, the N point attribute of the domain the field is evaluated over.
Inputs
geometry(Geometry, optional). Whose normals the field reads. A geometry carrying none has them computed from its primitives; the wired value is unchanged. Left unwired, the field reads the 'N' point attribute of the domain it is evaluated over.
Outputs
field: a Vec3 field (unwired) or the geometry's Vec3 normal column (wired).
Example
local points = g.mesh.grid({ cells = { x = 1, z = 1 } })
local out = g.attribute.set({ geometry = points, name = "v", value = g.field.normal({ geometry = g.mesh.grid({ cells = { x = 1, z = 1 } }) }) })
Every point of the flat grid reads (0, 1, 0).