form.measure

Whether a mesh is closed, the shape of each edge, and each face’s planarity and area, every answer with its evidence class.

GeometricSince 0.15.0

Usage

TypeScript
Form.measure(geometry: VerbInput, options?: FormMeasureOptions): Result<FormMeasure>

Parameters

  • geometryGeometry | VerbValue

    A polygon mesh with a vec3 f64 P.

    Required

  • options.facts('closed' | 'edges' | 'planar' | 'area' | 'repeats' | 'mirrors')[]

    The facts asked for; repeats and mirrors are searches, asked for by name. Default all but repeats and mirrors.

  • options.epsnumber

    repeats: the most false alarms a meaningful group may expect. Default 1. In count.

  • options.angleTolerancenumber

    repeats: how far normals may turn and still face the same way. Default 1e-9. In radians.

  • options.tolerancenumber

    A fraction of the bounding-box diagonal, used only where the exact answer is no. Default 1e-9. In ratio.

  • options.offsetnumber

    The first face listed. Default 0. In count.

  • options.limitnumber

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

Returns

Ok with { diagonal, tolerance, closed?, edges?, repeats?, faces }: closed and edge shapes are exact; a face is planar exactly, or within the tolerance with the deviation measured; repeats are groups of faces one translation maps onto each other and mirrors groups one plane swaps, both scored a-contrario (NFA ≤ eps).

Errors

Guarantees

  • an exact answer comes from exact predicates on the f64 input and never depends on a tolerance
  • edge convexity assumes outward winding: below the face at the edge is convex
  • The same result on every machine.

Example

TypeScript
Form.measure(Mesh.box().value) // → a closed box with 12 convex edges once loadGeometryKernel() has run

See also