How Do You Determine the Minimal Distance to a Circle in 3D Space?

  • Thread starter Thread starter Simon666
  • Start date Start date
  • Tags Tags
    3d Circle
AI Thread Summary
The discussion centers on determining the minimal distance from two points in 3D space to a circle defined by a radius and orientation. The initial approach involved using polar coordinates to express the sum of distances, but a mistake in the distance formula was identified. It was clarified that point p3 must lie on the circle, which is crucial for solving the problem correctly. The conversation also touched on deriving equations that involve trigonometric functions, leading to a complex equation that may be solvable through algebraic manipulation. The goal is to find an analytical solution for applications in simulating dynamic behavior in finite volume programs.
Simon666
Messages
93
Reaction score
0
Hi all, I'm new here. I would like to ask the following question: say you have in three dimensional space two points p1, p2 and a circle with radius r3 and given center and orientation. Then determine the point p3 for which the sum of the distances |p1p3| + |p2p3| is minimal. How do you do this?

My solution was to use polar cordinates (r1,f1,z1) and (r2,f2,z2) for the points, where the origin of the coordinate system is the center of the circle and the z-axis is normal to the plane of the circle. Then when you have a point (r3,f3,z3) the sum of the distances |p1p3| + |p2p3| can be written as:

  • r1² + r3² - 2*r1*r3*cos(f1-f3) + z1² + r2² + r3² - 2*r2*r3*cos(f2-f3) + z2²

We need to minimize this, and the only free parameter for this equaotion is f3 as all other parameters are specified. Hence we derive this equation in f3 and set it equal to zero in order to find minima and maxima:

  • 2*r1*r3*sin(f1-f3) + 2*r2*r3*sin(f2-f3) = 0

or, eliminating r3 and using the goniometric function for the sine of a difference:

  • r1*(sin(f1)cos(f3)-cos(f1)sin(f3)) + r2*(sin(f2)cos(f3)-cos(f2)sin(f3)) = 0

or by grouping the terms in sin(f3) and cos(f3):

  • ( r1*sin(f1) + r2*sin(f2) ) * cos(f3) - ( r1*cos(f1) + r2*cos(f2) ) * sin(f3) = 0

we find that the maxima and minima are the solution of:

  • tan(f3) = (r1*sin(f1)+r2*sin(f2)) / (r1*cos(f1)+r2*cos(f2))

Which seems quite easy but doesn't seem to be quite right when I calculate it using an example. Any idea where there is an error, what I am doing wrong?
 
Mathematics news on Phys.org
Welcome to PF!
As far as I can see, your mistake is in the derivation of the sum of distances (SofD)formula:
You seem to be using:
(SofD)^(2)=|p1p3|^(2)+|p2p3|^(2)

But this is incorrect!
 
Simon666 said:
Hi all, I'm new here. I would like to ask the following question: say you have in three dimensional space two points p1, p2 and a circle with radius r3 and given center and orientation. Then determine the point p3 for which the sum of the distances |p1p3| + |p2p3| is minimal. How do you do this?
Stated like this, take the point p3 somewhere on the straight line p1-p2, it doesn't really matter where on this line. Then |p1p3| + |p2p3| = |p1p2|.

But somehow I guess this is not the answer you were looking for, since the circle must have something to do with your question (otherwise you wouldn't have mentioned it, right?), something you haven't told us yet. Should the point p3 be on the circle or not? Should the points p1 and p2 be on the circle or not?

If you complete the question, I'll try to complete the answer :biggrin: .
 
"If you complete the question, I'll try to complete the answer"

It is quite evident from Simon666's (flawed) sum of distances formula that p1,p2 are arbitrary points in space, wheras p3 (related to stated radius r3) lies on the circle with z3=0
 
you may assume wlog that the circle lies in the x-y plane, has radius 1, and that the x-coordinate of p1 is 0, after suitable translations and so on. that should make it easier to see how the answer should work in general.
 
arildno said:
You seem to be using: (SofD)^(2)=|p1p3|^(2)+|p2p3|^(2)
Damn, it is the simple things, you just need someone outside to look at it once. Thanks. Back to point 1 I guess. For the other people: sorry it wasn't clear, but the point p3 has to be on the circle indeed.
 
Okay, derived the proper equations this time, get as result an equation with terms of powers of:

a + b*sin*sin + c*cos*cos + d*sin*cos + e*sin*sin*cos + f*cos*cos*cos = 0

Is this solvable?

The solution of this problem would be of use in a finite volume program for simulating the dynamic behaviour of a yarn, especially when it is sliding on the edge of a cylindrical surface, as to calculate tension and friction forces. Currently I am doing this numerically, but ofcourse an analyticalk solution would be nicer and a bit faster.
 
Last edited:
presumably a,b,c,d,e,f are fixed and the arguments of all the trig functions are the same, though how you have an equation whose terms are powers of an equation is a slight puzzle.

let sin^2(theta)=X so some other letter, so that cos^2=1-X, then you want to find the roots of

a+bX+c(1-x)+dsqrt(x)sqrt(1-x)+eXsqrt(1-X)+f(1-X)sqrt(1-X)

i'd suggest clearing all the radicals to one side, squaring and solving, seems like you'll have a cubic at worst to solve which can be done algebracially.

actually that doesn't quite come out nicely does it? damn
 
Last edited:
Back
Top