File Exchange

image thumbnail

Distance between points and ellipse

version 1.3.0.0 (9.77 KB) by Rody Oldenhuis
Compute the distances between an ellipse and an arbitrary number of points, in 3D

4 Downloads

Updated 10 Jun 2018

GitHub view license on GitHub

The solution to the problem of calculating the distance between an ellipse and a point is less than straightforward. The problem can be solved analytically however, which boild down to solving a quartic equation in cos(f), with (f) the true anomaly on the ellipse.
This submission implements this and computes the distances between any 3-D ellipse and an arbitrary number of 3-D points.
This is part of:
Ik-Sung Kim: "An algorithm for finding the distance between two ellipses". Commun. Korean Math. Soc. 21 (2006), No.3, pp.559-567
See also my other submission, distanceEllipseEllipse.

If you find this work useful, please consider a small donation:
https://www.paypal.me/RodyO/3.5

Comments and Ratings (2)

xiaoqing

okay, so for the example in your .m file to work, u,v need to be normalized before calculating the coordinates of those two points.

xiaoqing

a = [2.0 1.2];
b = [0.5 1.0];
c = {[0,0,0],[1,3,0]}; % location of centers

u = {[1,1,0], [1,0,0]}; % both oriented in XY-plane
v = {[-1,1,0], [0,1,0]}; % to visualize them more easily

does not seem to calculate a correct minimum distance?

Updates

1.3.0.0

Description update

1.3.0.0

[linked to Github]

1.2.0.0

Updated contact info

1.1.0.0

(1) Changed description (should've used the "preview" button..)
(2) Removed the ML 2009a/b tilde-syntax for better compatibility
(3) corrected small bug in the error handling (bracket bug)

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux