shortest distance between two circles in 3D

Returns the shortest distance between two circles in 3D, the pair(s) of closest points, and if the circles are equidistant.
16 download
Aggiornato 26 apr 2023

Visualizza la licenza

  • distanceCircleCircle3D.m Computes the shortest distances in 3D between two circles by solving an 8th order polynomial (after checking for special cases).
  • fminconDistanceCircleCircle3D.m performs the same task numerically, but is slower, only returns one solution, doesn't always find the optimum, and requires the Optimization toolbox.
  • testdistanceCircleCircle3D.m draws the circles and their minimum non-intersection tori. It also draws the special cases in 2D and many interesting cases in 3D.
  • compareAccuracyCircleCircle3D.m generates nSamples random circles and compares the accuracy and performance of distanceCircleCircle3D and fminConDistanceCircleCircle3D
distanceCircleCircle3D(N0, r0, C0, N1, r1, C1)
Inputs: two circles circle 0, and circle 1, each described by 3 parameters.
  1. N0: circle 0 normal vector (3x1)
  2. r0: circle 0 radius
  3. C0: circle 0 center position (3x1)
  4. N1: circle 1 normal vector (3x1)
  5. r1: circle 1 radius
  6. C1: circle 1 center position (3x1)
If no inputs are given, two random circles in 3D are generated.
Outputs:
result, a struct that includes the elements:
  1. distance: shortest distance (scalar)
  2. sqrDistance: squared shortest distance (scalar)
  3. numClosestPairs: how many closest pairs on the circles exist ,
  4. circle0Closest: coordinates of closest point on circle 0, 3xnumClosestPairs
  5. circle1Closest: coordinates of closest point on circle 1, 3xnumClosestPairs
  6. equidistant: if infinite solutions exist
Transcribed from C++ to Matlab by Aaron Becker atbecker@uh.edu, and Victor Montano, based on the 3D circle-circle distance algorithm described in https://www.geometrictools.com/Documentation/DistanceToCircle3.pdf and available at https://www.geometrictools.com/GTE/Mathematics/DistCircle3Circle3.h
The notation used in the code matches that of the document.
David Eberly, Geometric Tools, Redmond WA 98052
Copyright (c) 1998-2023
Distributed under the Boost Software License, Version 1.0.
https://www.boost.org/LICENSE_1_0.txt
https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
Version: 6.0.2022.01.06

Cita come

Aaron T. Becker's Robot Swarm Lab (2024). shortest distance between two circles in 3D (https://www.mathworks.com/matlabcentral/fileexchange/128183-shortest-distance-between-two-circles-in-3d), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2023a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.2

added tags

1.0.1

If the min distance points on circle 0 and 1 both differ by less than PRECISION, the code now declares they are equivalent and only returns 1 pair. Also added extra debugging cases to testdistanceCircleCircle3D().

1.0.0