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

• Simon666
In summary, the conversation discusses a mathematical problem involving determining the point p3 in three-dimensional space for which the sum of distances from two given points p1 and p2 is minimal, while also taking into account a circle with a given radius and center. The solution involves using polar coordinates and deriving an equation in terms of the angle f3, which can be used to find the maximum and minimum points. However, there is a mistake in the derivation of the sum of distances formula, and the conversation also discusses how to properly solve the resulting equation. The problem has practical applications in simulating the behavior of a yarn sliding on a cylindrical surface.
Simon666
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?

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 .

"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:

## 1. What is the formula for calculating the distance to a circle in 3D?

The distance to a circle in 3D can be calculated using the formula: d = |(ax + by + cz + d)| / √(a^2 + b^2 + c^2), where (x, y, z) represents a point on the circle's plane and (a, b, c) represents the normal vector of the plane. The absolute value of the numerator ensures that the distance is always positive.

## 2. Can the distance to a circle in 3D be negative?

No, the distance to a circle in 3D cannot be negative. It is always measured as a positive value from the given point to the closest point on the circle's plane. If the point is inside the circle, the distance will be 0.

## 3. How is the distance to a circle in 3D related to the radius of the circle?

The distance to a circle in 3D is not directly related to the radius of the circle. It is affected by the position of the point in relation to the circle's plane and the direction of the normal vector. However, the distance can be used to determine if a point is within the radius of the circle or outside of it.

## 4. Is there a difference between the distance to a circle and the distance to its center point?

Yes, there is a difference between the distance to a circle and the distance to its center point. The distance to a circle is measured from a given point to the closest point on the circle's plane, while the distance to the center point is measured from the same given point to the exact center of the circle. These two distances may not be the same, as the center point may not be on the circle's plane.

## 5. How is the distance to a circle in 3D used in real-world applications?

The distance to a circle in 3D can be used in various real-world applications, such as computer graphics, robotics, and navigation systems. It can be used to determine the proximity of an object to a circular surface, or to calculate the shortest distance between two points in 3D space. It is also commonly used in geometric calculations and measurements in engineering and physics.

• General Math
Replies
2
Views
1K
• Special and General Relativity
Replies
13
Views
2K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Introductory Physics Homework Help
Replies
2
Views
1K
• Introductory Physics Homework Help
Replies
1
Views
1K
• General Math
Replies
20
Views
3K
• Programming and Computer Science
Replies
6
Views
2K
• Precalculus Mathematics Homework Help
Replies
39
Views
4K
• Introductory Physics Homework Help
Replies
2
Views
2K
• Introductory Physics Homework Help
Replies
7
Views
4K