Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Distance to circle in 3D

  1. May 13, 2004 #1
    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?
     
  2. jcsd
  3. May 13, 2004 #2

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    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!
     
  4. May 13, 2004 #3
    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: .
     
  5. May 13, 2004 #4

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    "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
     
  6. May 13, 2004 #5

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  7. May 13, 2004 #6
    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.
     
  8. May 13, 2004 #7
    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: May 13, 2004
  9. May 13, 2004 #8

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    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: May 13, 2004
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Distance to circle in 3D
  1. Distance IN a circle (Replies: 1)

Loading...