Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

core.edges (procNode)

The edge table of a geometry: every distinct side of its primitives as a point pair (a < b), the primitives along each side, whether the side is open (one primitive) or manifold (at most two), and the edge each vertex slot's side belongs to.

Built from the edges kernel (the sides of every primitive), two stable sort passes (by the higher point, then the lower), gather, the edges_runs kernel (run heads, then the table), compact of the heads, an inclusive scan of the heads (the edge of each sorted place) and scatter through the slot order to give sideEdge, the edge id of every vertex slot.

Inputs

  • geometry (Geometry). The geometry whose sides are listed.
  • faces (Bool). Default true. True for a geometry of faces, whose primitives wrap from their last vertex to their first; false for curves, which wrap only where their closed attribute says.
  • device (Bool). Default false. True keeps the number of edges and the live vertex slots on the device: count is a count Column, the columns are allocated for as many edges as there are vertex slots, and every stage runs over the live vertex count. False reads the numbers back and sizes the columns by them.

Outputs

  • edges: Record a, b, faceStart, faceCount, faces, open, manifold, reversed, sideEdge (the edge each vertex slot's side belongs to, -1 for a slot with no side) and count.

Example

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

The 2 by 2 grid of triangles has 16 edges: edges.count is 16 and edges.faceCount holds 1 for the eight open ones and 2 for the inner ones.