geometryOps.translatePoints

A copy of a geometry with chosen points moved by their persistent id, exactly or spread by a falloff; ids, roles and topology unchanged.

GeometricSince 0.17.0

Usage

TypeScript
GeometryOps.translatePoints(geometry: Geometry | VerbValue, params: GeometryTranslatePointsParams): Result<VerbValue>

Parameters

  • geometryGeometry | VerbValue

    Polygon, curve or point geometry with a point id attribute (Int32, one per point); the input is not modified.

    Required

  • params.deltasnumber[]

    The record, flat: [id, dx, dy, dz, …], one entry per point id, each a translation in the input’s own frame; any order, at most 262 144 entries. Required. In model.

  • params.idScheme'persistent'

    What the ids in deltas name: persistent point ids, the only scheme.

    Required

  • params.falloffRadiusnumber

    Above 0, the deltas are handles spread to the points around them within this distance; 0 moves only the named points. Default 0. In model.

  • params.falloffMode'linear' | 'smooth' | 'sphere'

    The falloff curve; ignored when falloffRadius is 0. Default 'smooth'.

Returns

Ok with a VerbValue (the caller frees it): the geometry with P as Float64, each named point at P + d (exact mode) or every point within reach blended from the handles (falloff); data has points, primitives, moved (points whose position changed), handles (entries that named a point) and unmatched (entries that named none).

Errors

Guarantees

  • in exact mode each named point is at P + d, one f64 rounding per component, and every other point keeps its bits
  • a shuffled record, one with exact-mode zero entries and one with −0 components name the same value: one ref, one output, one set of diagnostics
  • ids, minters, roles, topology and every attribute other than P and N are unchanged; lineage records every point and primitive as carried
  • two records merged by adding each id’s delta give what applying their sum gives
  • the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
  • The same result on every machine.

Example

TypeScript
const r = GeometryOps.translatePoints(Mesh.box().value, { deltas: [1, 0, 0.5, 0], idScheme: 'persistent' })
r.ok || r.diagnostics[0].code // → GEOMETRY_INPUT_INVALID once loadGeometryKernel() has run: Mesh.box carries no point ids (Sources.box does)

See also