meshEdits.fuse

A copy of a polygon mesh with points within a distance welded into one and the faces that collapse dropped.

GeometricSince 0.16.0

Usage

TypeScript
MeshEdits.fuse(geometry: Geometry | VerbValue, params?: MeshFuseParams): Result<VerbValue>

Parameters

  • geometryGeometry | VerbValue

    Polygon geometry; the input is not modified.

    Required

  • params.distancenumber

    The weld radius; 0 welds only points at equal positions. Default 0. In model.

Returns

Ok with a VerbValue (the caller frees it): one point per weld cluster, faces through the weld with repeated neighbouring corners collapsed, faces left with fewer than three corners dropped; data has points, faces, mergedPoints and droppedFaces.

Errors

Guarantees

  • a point joins the lowest-index representative within distance; the representative keeps its position, attributes and id
  • no kept face has fewer than three corners or two equal neighbouring corners
  • kept faces keep their order, corners’ attributes and ids; lineage records each point as merged from every member and each dropped face as deleted
  • the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
  • The same result on every machine.

Example

TypeScript
const r = MeshEdits.fuse(Mesh.box().value, { distance: 0.001 })
r.ok || r.diagnostics[0].code // → the box’s 8 points, nothing merged, once loadGeometryKernel() has run

See also