meshEdits.bevel
A copy of a polygon mesh with chosen edges between two four-corner faces chamfered, flat or rounded.
Usage
MeshEdits.bevel(geometry: Geometry | VerbValue, params?: MeshBevelParams): Result<VerbValue>Parameters
geometryGeometry | VerbValuePolygon geometry; the input is not modified.
params.edgesArray<[number, number]>The edges to bevel, each as its two point indices; omit for every edge. Default
every edge.params.edgePointIdsArray<[MeshPointRef, MeshPointRef]>The edges to bevel by persistent point id, each a pair of { id, minter? }; not with edges. Default
none.params.widthnumberHow far each face recedes from the edge; 0 returns the input unchanged. Default
0.1. In model.params.segmentsnumberFaces across each chamfer, 1–64; more than one rounds it into an arc. Default
1. In count.params.scopestringThe host’s node id, for minted ids. Default
none: minted under 'bevel' with minter 0 (untrusted).
Returns
Ok with a VerbValue (the caller frees it): each bevelled edge’s two faces receded by width and joined by segments new quads; data has points, faces, bevelledEdges and skippedEdges.
Errors
Guarantees
- only an edge whose two ends belong to exactly its two faces, both four-cornered and wound the same way, is bevelled; the others, and an edge with a face of no normal, are counted in skippedEdges and left as they were
- each bevelled edge adds 2 · (segments + 1) points and segments faces; its two ends stay as points no face uses
- carried ids are unchanged and new ids are unique; lineage records each new point as generated from its edge end and each chamfer face from the edge’s two faces
- the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
- The same result on every machine.
Example
const r = MeshEdits.bevel(Mesh.box().value, { width: 0.1 })
r.ok || r.diagnostics[0].code // → every box edge skipped (its ends touch three faces) once loadGeometryKernel() has run