Builtin Library
- ..
- .metadata365 B
- README.md2.0 KB
- init.luau4.2 KB
- islands.module
README.md
topology.islands (procNode)
A geometry's connected components labelled: a per-primitive island id, and for each point the lowest island id among
the faces using it. connectivity joins faces across a shared edge or a shared point. Ids run from 0 in order of the
first face that carries them. Faces a group leaves out, and points no participating face uses, carry -1.
Inputs
geometry(Geometry): the geometry whose connected pieces are labelled.group(String, default""): names a 0/1 attribute onclassrestricting which faces take part; empty, the whole mesh takes part. A name the class does not carry is refused.class(String, default"primitive"): the classgrouplives on:"edge","point","primitive"or"vertex".promote(String, default"all"): how a group on a class other than"primitive"becomes a face set:"all"takes the faces every one of whose elements of that class is in the group,"any"the faces at least one is.connectivity(String, default"edge"): what joins two faces into one island:"edge", a shared edge, or"point", a shared point.attribute(String, default"island"): the name the island id is written under, per primitive and per point, plus a detail attribute<attribute>Countholding how many islands there are.
Outputs
A call answers a record by output name.
geometry(Geometry): the input with the island ids and the count written.islands(Data):count,sizes(faces per island, in id order),faceCount,connectivityandattribute.
Example
local a = g.sdf.sphere({ radius = 0.4, center = vector.create(-1, 0, 0) })
local b = g.sdf.sphere({ radius = 0.4, center = vector.create(1, 0, 0) })
local pair = g.sdf.mesh({ sdf = g.sdf.union({ a = a, b = b }), resolution = 24 }).geometry
local labelled = g.topology.islands({ geometry = pair })
local count = g.value.get({ data = labelled.islands, path = "count" })