geometryOps.merge

Polygon geometries combined into one in list order, attributes unioned, persistent ids kept unique and roles kept.

GeometricSince 0.16.0

Usage

TypeScript
GeometryOps.merge(geometries: readonly (Geometry | VerbValue)[], options?: GeometryMergeOptions): Result<VerbValue>

Parameters

  • geometries(Geometry | VerbValue)[]

    The inputs, in order (1–256); the verb takes them as geometry, a list of references.

    Required

  • options.scopestring

    The host’s node id: an id this merge has to mint is minted under it, with the node as minter. Default undefined (fresh ids under merge, minter 0).

Returns

Ok with a VerbValue (the caller frees it) of polygon geometry: input k’s points, faces and corners after input k − 1’s, corner indices moved by the points before them; data has points, faces, inputs and how many point and face ids were minted.

Errors

Guarantees

  • the point, face and corner counts are the sums of the inputs’, and each input’s positions appear in order
  • point ids are unique in the result and so are face ids; an element whose id is still free keeps it with its minter
  • every role stays on its element, and lineage records each element as carried from its input’s slot
  • the same inputs in the same order with the same scope give the same bytes; another order gives another ref
  • The same result on every machine.

Example

TypeScript
const r = GeometryOps.merge([Mesh.box().value, Mesh.box().value], { scope: 'merge1' })
r.ok || r.diagnostics[0].code // → 16 points and 12 faces once loadGeometryKernel() has run

See also