Problemcore
Minimum distance between surfaces
Also called surface distance computation, curve and surface distance.
Find the closest pair of points on two curves or surfaces, where both normals lie along the joining line, for clearance checks, collision and offsets.
The minimum distance problem asks for the pair of points, one on each of two parametric surfaces and , that are closest to each other, and for the distance between them. The same problem for a curve and a surface, or for two curves, has fewer parameters and the same structure. At an interior closest pair at positive distance, the joining segment is normal to both surfaces, which gives four equations in four unknowns. CAD systems use the answer for clearance checks between parts, for collision and gouge tests in machining, and to decide whether two faces can meet before an intersection is computed.
In plain words
Two curved sheets float in space without touching. You want the two spots, one on each sheet, that are closest to each other, and the gap between them.
At such a pair the straight line between the spots meets both sheets at a right angle. If it did not, you could slide one spot a little and make the gap smaller. This gives four equations, two for each sheet.
The equations also hold at pairs that are not the closest: at pairs that are farthest apart in some directions, and at pairs that are closest only nearby. Curved sheets can have many such pairs. So the problem is the same as finding the nearest spot to a point, only harder: there are twice as many unknowns, and if the sheets touch, the equations hold along a whole curve.
Definition
Input. Two regular parametric surfaces and of class on closed parameter boxes, usually Bézier patches, B-splines or NURBS. A tolerance .
Output. Parameters that minimize
the two points and , and the distance . In the numerical version is within of the true minimum. is continuous on a compact set, so the minimum exists.
Stationary conditions. Write . If is a minimizer inside , then
If moreover , then for a unit vector with , where and are the unit normals at the two points. So the joining line is a common normal, and the normals of the two surfaces are parallel.
Proof. is differentiable, with and , because does not depend on and , and and , because depends on through . At an interior minimum all four partial derivatives vanish, since a one-sided change of any single parameter must not lower . This gives the four equations. If , then . The first two equations say that is perpendicular to and , which span the tangent plane of because is regular, so is parallel to . In the same way the last two give .
The converse fails: a solution of the four equations, a common normal pair, can be a saddle or a maximum of . On the boundary of a box the equations of the fixed parameters are replaced by sign conditions, as for point projection: on the edge of , the first equation becomes . When the closest pair lies on an edge or a corner, the problem becomes a curve and surface problem, or a point and surface problem.
Contact. If , the four equations hold at every point of for the trivial reason . The minimizers are then the whole intersection curve, not isolated points, and the Jacobian of the system is singular there. A method must test for intersection first, or report the intersection as the answer. See surface surface intersection.
Variants
- Curve and surface. A curve and a surface : three equations , , in three unknowns, with . If the curve meets the surface, a case of curve surface intersection.
- Two curves. Two equations and . For two lines in space it is the common perpendicular of skew lines.
- Point and surface. Two equations, the point projection problem. It is the case where one surface shrinks to a point.
- Clearance test. Decide only whether for a given clearance . A lower bound is enough to say yes and one pair of points is enough to say no, so the test is easier than the computation of .
- All common normals. Return every solution of the four equations, which the distance functions of Patrikalakis and Maekawa, Chapter 7, need, and from which every local minimum can be read.
- Signed distance. For two closed surfaces that bound solids, the depth of penetration when they overlap. This needs the inside of each solid and is not the same as , which is for any overlap.
- Hausdorff distance. The largest distance from a point of one surface to the other surface, a max of a min instead of a min of a min. See Hausdorff distance.
Examples
- Two spheres. Spheres of radii and about and have , at the points and . Every common normal pair lies on the line of the centers, and there are four of them, at distances , , and . Only the first is a minimum.
- Skew lines. The lines and give , and the two equations are and . So , along the axis, the common perpendicular.
- A sphere and a bump. Let be the bicubic bump of the Newton point inversion page, with top height , and let be the sphere of radius about , below the top. For any point of the bump and of the sphere, , with equality on the segment from to , so is the distance from to the bump minus . That distance is , attained at the four points , , , , so with four closest pairs. The pair through the top, at distance , is also a common normal pair, but not a minimum.
- Coaxial cylinders. The cylinders and have , attained along a whole family of pairs, one for each angle and each height. The solutions of the four equations are not isolated, and Newton's method on them has a singular Jacobian at every solution.
- Contact. The planes and meet in the axis, , and every point of the axis gives a minimizing pair.
Known algorithms
- Newton on the four equations. Solve the system with Newton's method for systems from the best pair of a coarse sample of both surfaces. It converges quadratically near a nondegenerate minimum, and like Newton point inversion it gives the global answer only from a good start.
- Alternating projection. Project the current point of onto , then the result back onto , and repeat. Each step does not increase , because each projection minimizes over half of the variables. It converges linearly, slowly when the surfaces are nearly parallel.
- Subdivision with bounds. By the convex hull property, a Bézier patch lies in the convex hull of its control points, so the distance between the two hulls is a lower bound for . Split both nets with the de Casteljau algorithm, discard pairs of pieces whose lower bound exceeds the best distance found, and refine the rest. The distance between two hulls is the distance between two convex polytopes, which the GJK algorithm computes.
- All stationary points. The interval projected polyhedron method, applied to the four polynomial equations in Bernstein form, finds all common normal pairs in the boxes. Patrikalakis and Maekawa, Section 7.3, use it for the distance functions.
- Polygonal approximation. Replace both surfaces by triangle meshes within a known tolerance and use a mesh distance or collision detection method. The error of the mesh adds to the error of the answer.
Bounds
Nonconvex. is not convex in the parameters, even for two spheres: the four common normal pairs of the sphere example show a minimum, a maximum and two saddles. So no local method is guaranteed to find .
The hull bound. If and , then , since the minimum over larger sets is not larger. With the convex hulls of the control nets this gives the lower bound of the subdivision method, and it is whenever the hulls overlap, which is why the nets must be subdivided.
Accuracy from a sample. The distance is Lipschitz on the parameter box, with a constant that the derivative nets bound. A grid of spacing in each of the four parameters has a sample within of in each coordinate, so within in all, and its best value is within of . This gives an approximation with a proved error, at a cost of samples.
Degenerate cases. When the minimizers are not isolated, as for the coaxial cylinders or at contact, the four equations have a singular Jacobian at every solution. So no method that relies on a regular solution of the system can certify those cases. Interval and subdivision methods still give a correct value of , but not an isolated pair.
The stationary conditions, the common normal property, the hull bound and the sampling bound are proved on this page. The speed of the methods on real models is measured, not proved.
Reductions
- To a square system. Interior common normal pairs are the solutions of four equations in four unknowns, a case of systems of nonlinear equations.
- From point projection. A point is a degenerate surface, so point projection is a special case.
- A sphere to a point. The distance from a sphere of radius about to a surface is the distance from minus , when that is positive, as in the bump example. The same holds for the offset of any surface by : the distance between and is more than the distance between and the offset surface of at distance , as long as both are positive.
- To intersection. Deciding is deciding whether the two surfaces meet, so the problem is at least as hard as the decision version of surface surface intersection.
Applications
- Clearance and interference. Check that two parts of an assembly keep a gap, or find where they collide.
- Machining. A ball end tool gouges a surface when its center comes closer than the radius, the core of gouge detection. The distance between the tool path surface and the part decides it.
- Offsets and blends. If a surface has a common normal pair with itself of length , with the normals facing each other, its offset surface at distance passes twice through the midpoint. So the shortest such pair, with the largest curvature, bounds the offset distance at which the offset starts to intersect itself.
- Robotics. Distances between links and obstacles feed motion planners and collision avoidance.
- Before intersection. A positive lower bound on for two patches proves that they do not meet, so an intersection routine can skip the pair.
References
- Nicholas M. Patrikalakis and Takashi Maekawa, Shape Interrogation for Computer Aided Design and Manufacturing, Springer, 2002, Chapter 7, Distance functions, Section 7.2.1 (the definition of the distance between curves and surfaces), Section 7.2.2 (the geometric meaning of the stationary points, where the joining line is normal to both), Section 7.3 (the computation of all stationary points) and Section 7.4 (examples)
- Les Piegl and Wayne Tiller, The NURBS Book, second edition, Springer, 1997, Chapter 6, Section 6.1, Point inversion and projection for curves and surfaces, pages 229 to 234 (the point case, which the alternating method of this page repeats)
- Elmer G. Gilbert, Daniel W. Johnson and S. Sathiya Keerthi, A fast procedure for computing the distance between complex objects in three-dimensional space, IEEE Journal of Robotics and Automation 4(2), 193 to 203, 1988, the whole paper (the distance between convex hulls of point sets, used here as a lower bound for patches)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag T1RFAW Edit this page History Report an error Markdown