tolerance.resolve
The tolerance an operation uses: the caller’s when given, else the default for the input box.
Usage
Tolerance.resolve(tol: number | Tolerance | undefined, box: BBox): ToleranceParameters
tolnumber | Tolerance | undefinedThe caller’s tolerance: a bare number is an absolute distance with the default angle; a
Toleranceis used as given;undefinedmeans use the default. Required. In model.boxBBoxThe bounding box of the operation’s inputs, for the default. Required. In model.
Returns
A number goes through Tolerance.explicit; a Tolerance object is returned unchanged; undefined gives Tolerance.forBox(box). source says which branch was taken.
Guarantees
- a number tol gives Tolerance.explicit(tol) (deep equality)
- undefined gives Tolerance.forBox(box) (deep equality, source === 'bbox')
- a Tolerance object is returned as the same object (===)
Use instead
tolerance.forBox: you want the default and there is no caller tolerance to honour
Example
Tolerance.resolve(0.5, BBox.empty).absolute // → 0.5
Tolerance.resolve(undefined, BBox.ofPoints([Point3.origin, Point3.of(3, 4, 0)])).source // → 'bbox'