geometryOps.translate
A copy of a geometry with every position moved by an offset; normals, ids, roles and topology unchanged.
Usage
GeometryOps.translate(geometry: Geometry | VerbValue, offset?: Offset3): Result<VerbValue>Parameters
geometryGeometry | VerbValuePolygon, curve or point geometry; the input is not modified.
offset{ x?: number, y?: number, z?: number }The move; a missing component is 0. Default
{ x: 0, y: 0, z: 0 }. In model.
Returns
Ok with a VerbValue (the caller frees it; passing it on keeps its roles and lineage): the geometry, each Position attribute (three floats) at x + offset exactly; every other attribute, the topology, the ids and the roles as in the input.
Errors
Guarantees
- every position moves by exactly offset (x + offset, one rounding)
- translating by offset and then by −offset returns each coordinate within one rounding of |x| + |offset|
- ids, roles, normals and topology are unchanged
- the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
- The same result on every machine.
Example
const r = GeometryOps.translate(Mesh.box().value, { x: 2 })
r.ok || r.diagnostics[0].code // → the box moved 2 along x once loadGeometryKernel() has run