tolerance.explicit

A tolerance the caller chose, clamped into the usable range.

GeometricSince 0.3.0

Usage

TypeScript
Tolerance.explicit(absolute: number, angleRad?: number): Tolerance

Parameters

  • absolutenumber

    Distance below which two things count as coincident. Required. Range [0, 1.7976931348623157e+308] model.

  • angleRadnumber

    Angle below which two directions count as parallel; the default is one degree (π / 180). Default DEFAULT_ANGLE_TOLERANCE_RAD. Range [0, 1.5707963267948966] radians.

Returns

A tolerance with source: 'explicit'. A non-finite or non-positive absolute becomes 0 (exact coincidence only); a non-finite angle becomes the default, and a finite one is clamped to [0, π/2].

Guarantees

  • absolute is finite and ≥ 0 (Number.isFinite(t.absolute) && t.absolute >= 0)
  • angleRad is in [0, π/2] (t.angleRad >= 0 && t.angleRad <= Math.PI / 2)
  • t.source === 'explicit'

Use instead

Example

TypeScript
Tolerance.explicit(0.01) // → { absolute: 0.01, angleRad: 0.0174…, source: 'explicit' }
Tolerance.explicit(-1, 9) // → { absolute: 0, angleRad: 1.5707…, source: 'explicit' }

See also