samples.toHint

Points geometry as the bytes of a hint IPC points table, for hint’s table_read.

GeometricSince 0.15.0

Usage

TypeScript
Samples.toHint(points: Geometry | VerbValue): Result<VerbBytes>

Parameters

  • pointsGeometry | VerbValue

    Points geometry with a Float64 ×3 P: samples, or any points.

    Required

Returns

Ok with a VerbBytes { ref, bytes }; data has ref, bytes (the length), points and columns. The columns are x, y, z, then id when the points have one, then every other point attribute by name, a tuple of n as name.0 … name.(n−1).

Errors

Guarantees

  • the same points give the same bytes and the same ref, which is sha256: of the bytes
  • Samples.fromHint of the bytes gives back P, id and every point attribute, integers widened to Int32 or Uint32 and floats to Float64
  • The same result on every machine.

Example

TypeScript
const s = Samples.scatter(Mesh.box().value, { scope: 'scatter1', spacing: 0.5 })
s.ok && Samples.toHint(s.value) // → the bytes of a hint points table once loadGeometryKernel() has run

See also