samples.inspect

One page of samples with their ids and the chosen attributes: positions, normals, frames, anchors, levels or parents.

GeometricSince 0.12.0

Usage

TypeScript
Samples.inspect(samples: Geometry, options?: SampleInspectOptions): Result<SampleInspectPage>

Parameters

  • samplesGeometry

    Points geometry from Samples.scatter, Samples.frames or Samples.rebind.

    Required

  • options.offsetnumber

    The index of the first sample shown, a whole number ≥ 0. Default 0. In count.

  • options.limitnumber

    At most this many samples, 1–1000. Default 100. In count.

  • options.fields('P' | 'N' | 'T' | 'anchor' | 'level' | 'parent')[]

    The attributes each item shows; anchor gathers anchorPrim, its minter, the corners and barycentric coordinates on a mesh or uv on a surface. Default ['P', 'level'].

Returns

Ok with { total, offset, nextOffset?, items }: each item has index, id and idFrom, and the chosen fields in the order P, N, T, anchor, level, parent; nextOffset is absent on the last page, and an offset past the end gives no items.

Errors

Guarantees

  • items are the samples offset … offset + limit − 1 in order, so paging with nextOffset visits every sample once
  • the same samples and options give the same page
  • The same result on every machine.

Example

TypeScript
const s = Samples.scatter(Mesh.box().value, { scope: 'scatter1', spacing: 0.5 })
s.ok && Samples.inspect(s.value, { limit: 3, fields: ['P', 'anchor'] }) // → the first three samples once loadGeometryKernel() has run

See also