# Finding Shortest Distance between two 3d Parametrized Curves

Tags:
1. Sep 28, 2014

### admbmb

So I have two parametrized equations for two different 3d curves:

Rm(t) = (1.2*sin(2πt) + 0:3)i + t4j + 1.1cos2(2π(t + 0:2))k

and

R(t) = Sin(2πt)i + t3j + Cos2(2πt)k

I need to figure out if these two curves come within a certain distance of each other (0.5).

I cannot understand how to find the shortest distance between these two curves if I'm not given the specific points where these two curves are closest.

Any help is very appreciated!

2. Sep 28, 2014

### PeroK

You could calculate the distance between any two points on the two curves and use calculus to minimise this.

3. Sep 28, 2014

### FactChecker

I don't know if there is a trick for your specific problem but here is a general approach:

You need to create a distance function with the two curve parameters, t1, t2, as the independent variables. Then you can apply standard non-linear minimization algorithms to that function. There are likely to be local minimums that are not global minimums, so you may have to minimize many times starting at different initial values of t1 and t2. Let's say that the values of the parameters t1 and t2 are in [0,1]. I think that if you start at each of the corner values (t1,t1) = (0,0), (0,1), (1,0), (1,1), and you get the same minimum solutions for (t1_min, t2_min), then the minimum at that point is global. If you get different minimum solutions at the corners, then I would repeat the minimization from several starting values of (t1_initial, t1_initial)

4. Sep 28, 2014

### HallsofIvy

The "shortest distance" between two curves is always on a plane that is perpendicular to both curves. So the first thing I would do is determine the form a plane must have to be perpendicular to each curve.

5. Sep 28, 2014

### FactChecker

I'm having trouble visualizing that. Unless both curves are on a single plane, I don't see that a perpendicular plane exists.

6. Sep 28, 2014

### admbmb

Excellent, thank you! So I created a general function for distance, and then plotted that, and it looks correct. However, now I'm trying to solve for the roots of the derivative of that distance function to find where exactly the tangents are 0 (so I can find the minimum), but it's stuck calculating, and not returning results. The cell turns black (I'm using Mathematica) and stays that way. I'm trying to search to see if I can put bounds on the FindRoots, NSolve or Solve so that it doesn't evaluate forever, but no luck. Is there such a command? I only need to find the first value for which the derivative of distance is 0.

7. Sep 28, 2014

### FactChecker

Do you have assess to a math package that includes minimization algorithms? Davidon-Fletcher-Powell is a minimization algorithm one should be able to solve directly for the minimum.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook