# Thread: Calculate minimum distance between two circles from four distances.

1. ## Calculate minimum distance between two circles from four distances.

I'm doing some work on pipe thicknesses. I have to find the minimum wall thickness possible of a pipe at a given point from four tjhicknesses as shown in the picture below. (The circles are meant to be offset from each other as shown)

I have tried calculating at each angle using trig.

Outside circle:
$x1 = a*cos(\theta)
y1 = a*cos(\theta)$

Inside circle:
[LaTeX ERROR: Compile failed]

With the wall thickness being

$f(\theta) = (x1 - x2)^2 + (y1-y2)^2$

Substituting gives
$f(\theta) = 2*(b*c-a*c)*cos(\theta) + 2*(b*d-a*d)*sin(\theta) + (a^2+b^2+c^2+d^2-2*a*b)$

$f(\theta) = A*cos(\theta) + B*sin(\theta) + C$

Using matrix division these variables can be calculated.

$\left(\begin{array}{ccc}1&0&1\\0&1&1\\-1&0&1\\0&-1&1\end{array}\right)$ $\left(\begin{array}{cc}A\\B\\C\end{array}\right)=$ $\left(\begin{array}{cc}w0\\w1\\w2\\w3\end{array}\r ight)$

I've also taken into account the fact that if the solution is one of the four measured widths that this doesn't work.

Unfortunately this is still giving the wrong answer, I suspect it might be partially down to the fact that as you can see in the original picture the angles that the measurements intersect the circles is not the same which is assumed in these calculations.

Can you guys think either of a way to fix my broken set of equations or an entirely different way to solve the problem? I'm finding what seems like a fairly simple problem deceptively difficult.

Thanks, Matt.

2. So, let me get this straight: you've got one pipe, and its hollow portion inside, while circular, is not concentric. You make four measurements of the thickness at the 0, 90, 180, and 270 degrees locations. From this data, you would like to find the thickness of the thinnest spot of the pipe, as measured normal to the outer surface of the pipe. Is that correct?

3. That is correct.

4. Here's the approach I would take, then. Set the origin as the center of the outer circle.

1. Find the equation of the inner, non-concentric circle. Since you have four points on the circle, this should be quite doable (three points determines a circle).

2. Since you have computed the coordinates of the center of the circle, call them $(a,b)$, you now know the line along which the thinnest point should occur. It'll be the line formed by joining the origin (the center of the outer circle) with the center of the inner circle. Find the equation of this line. It should be the following:

$y=\dfrac{b}{a}\,x.$

3. Find the two intersections of this line with the inner circle. Select whichever of those two intersections is farther away from the origin. Call this point P.

4. Find the two intersections of the same line with the outer circle. This should be easy: $r(\cos(\theta),\sin(\theta)),$ where $\tan(\theta)=b/a.$ Select whichever of these two points is closer to P, and call it Q.

5. Final answer is the distance from P to Q.

See the attached jpg for an illustration.

How does that sound?

5. I hadn't seen that the thinnest point would be on the line between the two origins, thanks for pointing that out!

I have previously tried your approach but couldn't get it to work. My problem is still however with defining the equation for either circle. While I can work out the origin for the inner circle, being the difference in the wall thicknesses (ie x = (w0-w2)/2 and y = (w1 - w3)/2) I don't see how to work out the radius of either circle from the information I have.

6. Oh. I was kind of assuming you already knew the radius of the outer circle. Do you not know that? Do you still have the ability to make measurements? Can you measure the diameter of the outer circle?

7. Unfortunately I don't do the measurements, I just have a list of the thickness measurements. So I don't have access to any information about either diameter, which makes things much more difficult.

8. All right. You can still follow my procedure. Let $D$ be the outer diameter, and let $d$ be the inner diameter. Consider the four points:

$P_{0}=(D/2-w_{0},0),$

$P_{1}=(0,D/2-w_{1}),$

$P_{2}=(-D/2+w_{2},0),$

$P_{3}=(0,-D/2+w_{3}).$

They are the coordinates of the intersections of where you measured your four thicknesses, with the inner circle. Let $(a,b)$ be the coordinates of the center of the inner circle, with the origin at the center of the outer circle. Then you have three unknowns: $a, b, D.$ But you also have three equations:

$|(a,b)-P_{0}|=|(a,b)-P_{1}|,$

$|(a,b)-P_{0}|=|(a,b)-P_{2}|,$

$|(a,b)-P_{0}|=|(a,b)-P_{3}|.$

I used Mathematica to solve these equations for the unknowns. It spits out three answers, two of which, while they may solve the equations in certain special circumstances, are not, I think, the most general. Here they are:

Solution 1:

$a=\dfrac{w_{1}(w_{2}-2w_{3})+w_{2}w_{3}+w_{0}(w_{1}-2w_{2}+w_{3})}{2w_{2}-2w_{0}},\;b=\dfrac{1}{2}\,(w_{3}-w_{1}), \;D=w_{0}+w_{2}.$

Solution 2:

$a=\dfrac{1}{2}\,(w_{2}-w_{0}),\;b=\dfrac{w_{1}(w_{2}-2w_{3})+w_{2}w_{3}+w_{0}(w_{1}-2w_{2}+w_{3})}{2w_{3}-2w_{1}},\;D=w_{1}+w_{3}.$

Solution 3: (I think this the most likely one)

$a=\dfrac{1}{2}\,(w_{2}-w_{0}),\; b=\dfrac{1}{2}\,(w_{3}-w_{1}),\;D=\dfrac{2w_{0}w_{2}-2w_{1}w_{3}}{w_{0}-w_{1}+w_{2}-w_{3}}.$

Now then: we can compute the diameter of the inner circle as follows:

$\dfrac{d}{2}=|(a,b)-P_{0}|,$ or

$\dfrac{d^{2}}{4}=(D/2-w_{0}-a)^{2}+b^{2},$ or

$d^{2}=4((D/2-w_{0}-a)^{2}+b^{2}).$

Finally, if $w$ is the target thickness at the thinnest spot, we must have that

$w+\dfrac{d}{2}+|(a,b)|=\dfrac{D}{2},$ implying that

$w=\dfrac{D}{2}-\dfrac{d}{2}-|(a,b)|.$

Does that makes sense?

9. Hey thanks for the reply again. It all makes sense and I came out with the outer diameter equation you got in Solution 3 as well when I was trying to solve it analytically by hand. Unfortunately the results I get are not what are expected, for example (11, 10.9, 11.2, 11.1) gives an outer diameter of around 22 and I know these pipes have a diameter greater than 100. I'm starting to strongly suspect that these widths alone are not enough information to define the equations of the circles fully.

10. I think you may be right. If you think about the special, concentric case, you could increase both the inner and outer diameters at the same rate, and not change the width measurements you take. The same might be true in the non-concentric case.

Thinking about the actual physical problem: if you have the ability to measure those widths, then surely you could measure the outer diameter. If you have access to the end of a pipe, then you could even measure the inner diameter pretty closely with an internal caliper. That would enable you to uniquely solve the problem, I think.