
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
This Demonstration shows how to compute the minimum distance between two circles in 3D and draw the line segment joining the minimizing points. When the circles are on parallel planes and their projections intersect, then there are two line segment solutions. If the circle projections onto each other are concentric, then the circles are equidistant and there are an infinite number of solutions. In this case, a pair of points is selected. You can move the position and orientation of the red circle and change the radius of both circles. Additionally, you can construct a torus around each circle with a tube-radius of half the minimum distance using the "torus opacity" slider.
Contributed by: Aaron T. Becker and Victor M. Baez (May 8)
Open content licensed under CC BY-NC-SA
Details
The code in this Demonstration was transcribed to Wolfram Language from the C++ 3D circle-circle distance algorithm by David Eberly [2]. Two circles and
are defined by their centers
and
, their radii
and
and the unit normals to their planes
and
. Consider the squared distance
between a point
on
and the corresponding point
on
that is closest to the projection of
onto the
plane. Minimizing the function
involves finding the roots of a polynomial of degree eight and keeping track of the points
and
that produce the shortest distance.
Special cases arise when the two circles are on parallel planes. The problem can then be treated as if it were in 2D. A separate function is called to find the solution given the circle centers and radii. For some positions, there are two pairs of points that are the same distance apart (see Snapshot 2). If the two circles are on the same plane, then there are two such pairs of points, and the distance from to
for each pair is 0.
The full derivation and explanation can be found in [1].
The center and the unit normal
, where
is the latitude and
is the longitude.
References
[1] D. Eberly. "Distance to Circles in 3D." Geometric Tools (Apr 27, 2023) www.geometrictools.com/Documentation/DistanceToCircle3.pdf.
[2] D. Eberly. DistCircle3Circle3.h. Geometric Tools (Apr 27, 2023) www.geometrictools.com/GTE/Mathematics/DistCircle3Circle3.h.
Snapshots
Permanent Citation