form.relate

How two faces, or two sets of faces, of a mesh relate: touching, adjacent, parallel, orthogonal, coplanar, each with its evidence class and a caption.

GeometricSince 0.15.0

Usage

TypeScript
Form.relate(geometry: VerbInput, a: number | number[], b: number | number[], options?: FormRelateOptions): Result<FormRelation>

Parameters

  • geometryGeometry | VerbValue

    A polygon mesh with a vec3 f64 P.

    Required

  • anumber | number[]

    A face, or a set of faces. Required. In index.

  • bnumber | number[]

    A face, or a set of faces. Required. In index.

  • options.relations('touching' | 'adjacent' | 'parallel' | 'orthogonal' | 'coplanar')[]

    The relations asked for. Default all five.

  • options.tolerancenumber

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

  • options.angleTolerancenumber

    For parallel and orthogonal, used only where the exact answer is no. Default 1e-9. In radians.

Returns

Ok with { a, b, relations }: each relation with evidence { holds, class, measured?, tol? } and a caption such as “faces 0 and 1 are parallel, exactly”.

Errors

Guarantees

  • touching and adjacent are exact; parallel, orthogonal and coplanar are exact for planar faces and otherwise tolerance answers with the angle or distance measured
  • for sets, touching and adjacent hold when some pair does, parallel, orthogonal and coplanar when every pair of different faces does; a deciding pair gives the class
  • the same mesh and faces give the same answer
  • The same result on every machine.

Example

TypeScript
Form.relate(Mesh.box().value, 0, 1) // → parallel, exactly, once loadGeometryKernel() has run

See also