Skip to main content

Module proximity

Module proximity 

Source
Expand description

Minimum distance between shapes.

Elsewhere this is BRepExtrema_DistShapeShape. The geometry-level extrema in ogeom-intersect answer where two curves or surfaces come nearest; this module assembles those answers for topology, where a shape is vertices, edges and faces and the nearest approach may land on any of them.

§The assembly argument

The nearest distance between two shapes is attained either at an interior stationary approach of a pair of elements, or on some element’s boundary, and an element’s boundary is itself an element: a face’s boundary is its edges, an edge’s boundary is its vertices. So walking every pair of elements (vertex against vertex, edge and face; edge against edge and face; face against face) with stationary approaches for the interiors and projections for the points covers every candidate, and the geometry level is allowed to answer “no interior approach” honestly because the pair that owns the boundary case is in the same sweep.

A face’s interior approach is accepted only where its foot lands inside the face’s trimming; a foot outside or too near the boundary is dropped, because the true nearest point of that configuration is on an edge and the edge pairs find it exactly.

§What the distance is between

Boundaries. A shape strictly inside another reports the gap between their boundaries, not zero: whether a point is inside a solid is classify_in_solid_exact’s question, and conflating the two would make this answer wrong for the shells it is right for.

Structs§

ClosestPair
One pair of nearest points, with the elements they lie on.
ShapeDistance
The minimum distance between two shapes, with everywhere it is attained.

Functions§

distance_between_shapes
The minimum distance between two shapes’ boundaries.