selection.evaluate

The faces or points of a mesh that a selector names, with their connected patches and how close the pick came to changing.

GeometricSince 0.5.0

Usage

TypeScript
Selection.evaluate(target: SelectionTarget, selector: unknown, kind?: "prim" | "point", at?: Scope): Result<Selection>

Parameters

  • targetSelectionTarget

    { mesh, pointIds?, primIds?, f32? }: the mesh, its persistent ids when it has them, and whether its positions were stored in f32.

    Required

  • selectorunknown

    A selector; it is parsed first.

    Required

  • kind"prim" | "point"

    Select faces or points; normal applies to faces only. Default "prim".

  • atScope

    Revision and node to stamp on the result set. Default {}.

Returns

Ok with { set (ascending indices, pids when the target has ids), patches, margin, tolerance }; warnings ride on the Ok.

Errors

Guarantees

  • set.indices is ascending and identical for a translated, scaled or point-relabelled copy of the mesh
  • a planar face matches exactly when every triangle of its triangulation matches (the same region on a triangulated copy of the mesh)
  • patches counts edge-connected matched faces: a box top is 1 whether it is one quad or two triangles
  • The same result on every machine.

Example

TypeScript
const box = Mesh.box(Vector3.of(2, 1, 1)).value
Selection.evaluate({ mesh: box }, { where: { extremal: "+z" } }).value.set.indices // → [1]

See also