meshEdits.edgeSlide
A copy of a polygon mesh with the points of chosen edges slid along their neighbouring edges; the topology is unchanged.
Usage
MeshEdits.edgeSlide(geometry: Geometry | VerbValue, params?: MeshEdgeSlideParams): Result<VerbValue>Parameters
geometryGeometry | VerbValuePolygon geometry; the input is not modified.
params.edgesArray<[number, number]>The edges to slide, each as its two point indices; omit for every edge, which moves nothing (every point is then on three or more selected edges or has no rail). Default
every edge.params.edgePointIdsArray<[MeshPointRef, MeshPointRef]>The edges to slide by persistent point id, each a pair of { id, minter? }; not with edges. Default
none.params.factornumberHow far, from −1 to 1, as a fraction of each point’s rail; the sign picks the side, 0 returns the input unchanged. Default
0. In ratio.params.evenbooleanEvery point moves the same distance (the first rail’s), clamped to its own rail. Default
false.params.flipbooleanThe other side: the same as factor negated. Default
false.
Returns
Ok with a VerbValue (the caller frees it): the same points, faces and corners, with the slid points moved; data has points, faces and movedPoints.
Errors
Guarantees
- every point keeps its index, id and roles; only P and the normals of what moved change
- a slid point stays on the segment to its rail’s far end and stops 0.1 % short of it, so no face collapses
- lineage records every point and face as carried
- the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
- The same result on every machine.
Example
const r = MeshEdits.edgeSlide(Mesh.box().value, { edges: [[0, 1]], factor: 0.5 })
r.ok || r.diagnostics[0].code // → the box with that edge's points slid half way once loadGeometryKernel() has run