- 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.
- N0: circle 0 normal vector (3x1)
- r0: circle 0 radius
- C0: circle 0 center position (3x1)
- N1: circle 1 normal vector (3x1)
- r1: circle 1 radius
- 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:
- distance: shortest distance (scalar)
- sqrDistance: squared shortest distance (scalar)
- numClosestPairs: how many closest pairs on the circles exist ,
- circle0Closest: coordinates of closest point on circle 0, 3xnumClosestPairs
- circle1Closest: coordinates of closest point on circle 1, 3xnumClosestPairs
- 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
引用格式
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. 检索时间: .
MATLAB 版本兼容性
创建方式
R2023a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!