Module exact_distance
Expand description
Certified distance between the boundaries of two exact B-reps (#125, C18).
§What is certified
boundary_distance returns an interval [lower, upper] that contains
the true minimum distance between the two boundaries, and two points, one
on each boundary, exactly upper apart. Both ends are guarantees, not
estimates:
upperis the distance between two points that lie on the boundaries: points on edges, or surface points at parameters the face’s domain is certified to contain (the crate-privateDomainclassifier).lowercomes from bounding spheres that enclose every point of a patch of a face’s parameter domain, from Lipschitz bounds on the exact surface, with a margin for rounding. Patches are dropped only when certified to lie outside the face.
A rule that compares a distance with a limit asks boundary_clearance,
which refines only until the interval clears the limit and otherwise says
Clearance::Indeterminate – a value within rounding of the limit is
never reported as a pass or a fail.
§Method
Branch and bound over pairs of elements, one from each B-rep: face patches (a rectangle of a face’s parameters) and edge spans. The pair with the smallest lower bound is refined by splitting its larger element. Refinement stops when the smallest remaining lower bound is within the requested accuracy of the best upper bound, or the step budget runs out; either way the interval returned is sound.
Bounds are second order where the family allows: the range of d . x
over a patch is exact for planes, cylinders, elliptical cylinders, cones,
spheres and tori and for line, circle and ellipse edges, and d is taken
along the line between centres and along each patch’s normal. A face
patch whose normals cannot point at the other element is dropped from
that pair (critical_possible): the closest pair of two separated
boundaries is critical on each face it lies inside or lies on an edge,
and edges are elements of their own.
§Convergence
An isolated nearest pair (pole to pole, apex to sphere, a wall to a
block face) closes to 1e-9 in well under a second. Where the nearest
points form a whole line – two parallel columns – every slice along
that line is a near-minimal pair and refinement slows; ask such cases for
a looser accuracy, or use boundary_clearance, which stops as soon as
the limit is cleared. The step budget is fixed; when it runs out the
interval returned is still sound, only wider.
§Scope
This is the distance between BOUNDARIES. Two solids that overlap measure the distance between their surfaces where they cross (zero), but a solid wholly inside another measures the gap between the two boundaries, not zero. Containment is a separate classification.
Structs§
- Distance
Bounds - An interval certain to contain the distance between two boundaries.
Enums§
- Clearance
- How a certified distance compares with a limit.
Functions§
- boundary_
clearance - Refine the distance only until it clears
limit. - boundary_
distance - Distance between the boundaries of
aandb, to withinaccuracy.