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?(adsbygoogle = window.adsbygoogle || []).push({});

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?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Distance to circle in 3D

**Physics Forums | Science Articles, Homework Help, Discussion**