tolerance.forBox

The kernel’s default tolerance for an input of a given extent: the box diagonal × 1e-9.

GeometricSince 0.3.0

Usage

TypeScript
Tolerance.forBox(box: BBox, angleRad?: number): Tolerance

Parameters

  • boxBBox

    The bounding box of the input (of all inputs, for an operation on several). Required. In model.

  • angleRadnumber

    Angle below which two directions count as parallel; the default is one degree (π / 180). Default DEFAULT_ANGLE_TOLERANCE_RAD. In radians.

Returns

A tolerance with source: 'bbox' and absolute = BBox.diagonal(box) × 1e-9; 0 for an empty box or a single point (exact coincidence only).

Guarantees

  • absolute equals BBox.diagonal(box) * 1e-9
  • it scales with the model: a box scaled by s gives s × absolute (scale invariance)
  • t.source === 'bbox'

Use instead

Example

TypeScript
Tolerance.forBox(BBox.ofPoints([Point3.origin, Point3.of(3, 4, 0)])).absolute // → 5e-9

See also