samples.fromHint

Points geometry from the bytes of a hint IPC points table that hint’s table_write made.

GeometricSince 0.15.0

Usage

TypeScript
Samples.fromHint(bytes: Uint8Array): Result<VerbValue>

Parameters

  • bytesUint8Array

    A hint IPC file holding a points table (hint’s table_points, then table_write with format ipc).

    Required

Returns

Ok with a VerbValue (the caller frees it); data has ref, contentHash, points and attributes. P comes from x, y, z; id from the id column; Float64 columns are Float64 attributes, Int64 columns Int32 or Uint32, and name.0 … name.(n−1) join into one tuple.

Errors

Guarantees

  • the same bytes give the same ref and content hash
  • Samples.toHint of the result gives the same bytes back
  • The same result on every machine.

Example

TypeScript
const s = Samples.scatter(Mesh.box().value, { scope: 'scatter1', spacing: 0.5 })
const b = s.ok ? Samples.toHint(s.value) : undefined
b?.ok && Samples.fromHint(b.value.bytes) // → the same samples back once loadGeometryKernel() has run

See also