Log inGet started
Package

core.nodebox

Newest version

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

README.md

core.normals.face (procNode)

Give every primitive its normal: the direction its vertices wind around, written as N on the primitive class. scaled is the same direction scaled by twice the primitive's area.

Built from core.corners, attribute.promote (point to vertex), gather of the next corner, math.cross and a segmented reduce over each primitive's run (segments = primitive.count).

Inputs

  • geometry (Geometry). The geometry whose primitives get normals.
  • name (String). Default "N". The attribute the normals are written under on the primitive class.

Outputs

  • geometry: the geometry with a normal on every primitive.
  • scaled: the same direction scaled by twice the primitive's area, a Vec3 column per primitive.

Example

local grid = g.mesh.grid({ size = { x = 2, z = 2 }, cells = { x = 2, z = 2 } })
local faces = g.core.normals.face({ geometry = grid })

faces.geometry carries N on every primitive and faces.scaled the same direction scaled by twice each primitive's area.