7

I am an engineer working on a machine designed to measure the diameters of cylindrical bores. To provide a clear and engaging context for my question, I'll describe the physical scenario in detail.

Ideal Senario:

Imagine a round measuring tool, represented as a dark blue circle with diameter $d$, with three probes labeled as $Pa$, $Pb$, and $Pc$. These probes are evenly spaced at angles of $62$ degrees ($\theta$) from each other. The measuring tool is inserted into a round bore, represented as the red circle, to measure its diameter ($D$). The goal is to find $D$ in all senarios.

enter image description here enter image description here

In this ideal scenario, calculating the bore diameter is straightforward since the measuring tool parallel to the part bore and we have 3 points!

$Pa=[Pa_x,Pa_y,Pa_z]=[-(9.322+25)Sin⁡(62^{\circ}), -(9.322+25)Cos⁡(62^{\circ}), 0]$
$Pb=[Pb_x,Pb_y,Pb_z]=[0, -(9.988+25), 0]$
$Pc=[Pc_x,Pc_y,Pc_z]=[(15.603+25)Sin⁡(62^{\circ}), -(15.603+25)Cos⁡(62^{\circ}), 0]$

If you're interested in the solution for this ideal case, it can be found below.

$x_1 = -(a + r) Sin(\theta)=-(9.322+25)Sin⁡(62^{\circ})$
$y_1 = -(a + r) Cos(\theta)=-(9.322+25)Cos⁡(62^{\circ})$
$x_2 = 0$
$y_2 = -(b + r)=-(9.988+25)$
$x_3 = (c + r) Sin(\theta)=(15.603+25)Sin⁡(62^{\circ})$
$y_3 = -(c + r) Cos(\theta)=-(15.603+25)Cos⁡(62^{\circ})$
$A1 = x_1 (y_2 - y_3) - y_1 (x_2 - x_3) + x_2 y_3 - x_3 y_2$
$B1 = (x_1^2 + y_1^2) (y_3 - y_2) + (x_2^2 + y_2^2) (y_1 - y_3) + (x_3^2 + y_3^2) (y_2 - y_1)$
$C1 = (x_1^2 + y_1^2) (x_2 - x_3) + (x_2^2 + y_2^2) (x_3 - x_1) + (x_3^2 + y_3^2) (x_1 - x_2)$
$D1 = (x_1^2 + y_1^2) (x_3 y_2 - x_2 y_3) + (x_2^2 + y_2^2) (x_1 y_3 - x_3 y_1) + (x_3^2 + y_3^2) (x_2 y_1 - x_1 y_2)$
$Diameter = 2\sqrt{\frac{B1^2 + C1^2 - 4 A1 D1}{4 A1^2}}=80.0002$
This agrees with the CAD!


Actual Senario:

However, in practical situations, we encounter both lack of measurement accuracy and repeatibility. This is because the measuring tool is not perfectly aligned parallel to the bore. Instead, the bore is at some angle relative to the measuring tool, which we'll refer to as the "runout angle" ($\alpha$).
Consider the 3d Model of this below:

enter image description here

From the perspective of the measuring tool, the measuring tool is now measuring an oval shape. In this case the ideal senario diameter calculation does not hold!
See 2D drawing below:

enter image description here

We therefore have the following points on the part bore:
$Pa=[Pa_x,Pa_y,Pa_z]=[-(9.51+25)Sin⁡(62^{\circ}), -(9.51+25)Cos⁡(62^{\circ}), 0]$
$Pb=[Pb_x,Pb_y,Pb_z]=[0, -(8.71+25), 0]$
$Pc=[Pc_x,Pc_y,Pc_z]=[(15.273+25)Sin⁡(62^{\circ}), -(15.273+25)Cos⁡(62^{\circ}), 0]$


Adding 3 additional probes (which can determine α)

Our goal is to determine the actual bore diameter.
To achieve this we add three additional probes, labeled as $P1$, $P2$, and $P3$, which are mounted perpendicular to the measuring tool.
These probes measure the plane that the part bore is "mounted" to!
This plane is perpendicular to axis of the bore!

Using these probes we are able to determine the runout angle ($\alpha$).
Consider the 3D and 2D represntations of this below:

enter image description here

enter image description here

Calculating the runout angle is straightforward because it involves three points. $P1 = [P1_x, P1_y, P1_z] = [-25,0,25]$
$P2 = [P2_x, P2_y, P2_z] = [0,-25,15]$
$P3 = [P3_x, P3_y, P3_z] = [25,0,13]$

If you're interested in the solution for finding the runout angle ($\alpha$) from these 3 points, it's available below:

We find two vectors on the plane by subtracting one point from another:
$\overrightarrow{a}=P2-P1=[25,-25,-10]$
$\overrightarrow{b}=P3-P1=[50,0,-12]$

Now we compute the cross product of these two vectors. This is the vector normal to the part bore. $\overrightarrow{v}=\overrightarrow{a}×\overrightarrow{b}=[v_x,v_y,v_z]=[300,-200,1250]$

We can also define the vector normal to the measuring tool. This is the vector normal to the plane $z=0$, which is simply $\overrightarrow{n}=[0,0,1]$.

With both vectors $\overrightarrow{n}$ and $\overrightarrow{v}$ established, we can now calculate the total angle $\alpha$ between them.

First, let's calculate the magnitude of $\overrightarrow{v}$: $M = \sqrt{v_x^2+ v_y^2+ v_z^2}=\sqrt{(300)^2+(-200)^2+(1250)^2}=1300.961$

Next we need to determine the dot product $d$ of the two vectors $\overrightarrow{n}$ and $\overrightarrow{v}$. $d=v_x×0 + v_y×0+ v_z×1= v_z = 1250 $

Finally we can compute the total runout angle $\alpha$
$\alpha=Cos^{-1}(\frac{d}{M})=Cos^{-1}(\frac{1250}{1300.961})=16.09^{\circ}$
This agrees with the CAD!


Now the question arises:
Is it possible to obtain the true diameter of the bore from the points $Pa,Pb,Pc,P1,P2,P3$?


Msegling
  • 285
  • Something seems to be wrong in the calculation of $\alpha$. You don't have the points P1,P2,P3 in a plane that is perpendicular to the axis of the bore, so there's no way you can compute the angle between the axis of the measuring tool and the axis of the bore from the coordinates of P1 , P2 , P3 the way you did. I think you need to consider the coordinates of the six points which you can measure with the six probes, and which lie on the inner surface of the bore cylinder. You can these six points to build the equation of the bore cylinder, and that will give the diameter and $\alpha$. – Hosam Hajeer Oct 20 '23 at 20:17
  • @HosamH Thanks for the comment. In my opinion, its not necessary for P1, P2, and P3 to be in a plane perpendicular to the axis of the bore. Their purpose is to establish the orientation of measuring tool's axis relative to the bore's axis. By measuring these points relative to the center of the measuring tool (the origin), I can determine the runout angle (α) by finding a plane that best fits these points. As you can see, α obtained from CAD (α=35.4) matches α obtained from using 3 points relative to center to the measuring tool (α=35.35). Could you give me more infomation on why you disagree? – Msegling Oct 20 '23 at 21:10
  • Probes $a,b,c$ are located in the same plane and assuming that the measures are done in a plane parallel to $(x,y,0)$ what is the value of $z$?. Regarding the probes $P_1,P_2,P_3$ they are located at different $z$s but it is not clear to me what they measure, their measure values. – Cesareo Oct 20 '23 at 23:37
  • I am supposing that the values given associated to $P_1,P_2,P_3$ are their location and not any measure. – Cesareo Oct 20 '23 at 23:43
  • Why not have your tool touch the bore side? – Moti Oct 21 '23 at 06:02
  • @Cesareo Thanks for your comments! It seems I did not do a great job formulating my question. Ive edited the question to include 3d models. Hopefully it is clear. Please let me know if there is anything that is still confusing! Looking forward to your response. – Msegling Oct 21 '23 at 13:50
  • @Moti Ive edited the question to make it more clear. To answer your question, the machine has been designed to not allow the measuring tool to touch the bore. This is done to ensure we do not damage the customers parts. – Msegling Oct 21 '23 at 13:52
  • What you want to do is to project the center of the measuring tool, Pa, Pb, and Pc all onto the plane spanned by P1, P2, P3 (or any plane perpendicular to that plane.) First find the normal to the plane by n = (P2-P1) x (P3-P1). Once you have the normal, use proj( v ) = $ v - (v \cdot n)/|| n || $ where $|| n || = \sqrt{ n_x^2 + n_y^2 + n_z^2}$. Once, you have proj(Pa), proj(Pb), proj(Pc) and proj(center), you can measure the distances and use your first method. – irchans Oct 21 '23 at 14:55

2 Answers2

4

Your three points $P_a$, $P_b$, $P_c$ lie on an ellipse in the plane $z=0$. The radius of the cylinder you have to find is the minor axis $b$ of that ellipse, while its major axis is $a=b/\cos\alpha$.

From points $P_1$, $P_2$, $P_3$ you can find the equation of the plane they lie on, and its intersection with plane $z=0$ which is some line $l$. Line $l$ is parallel to the minor axis of the ellipse. You should take as $y$ axis a line through the origin parallel to $l$ and as $x$ axis a line perpendicular to $l$. (This can be done, for instance, rotating $(x,y)$ by the angle $\phi$ between $l$ and $y$-axis).

If you recompute the coordinates of $P_a$, $P_b$, $P_c$ in this new coordinate system, you can write three equations for the unknowns $(x_0,y_0)$ (location of the center of the ellipse) and $b$ (minor axis): $$ (x_a-x_0)^2\cos^2\alpha+(y_a-y_0)^2 = b^2\\ (x_b-x_0)^2\cos^2\alpha+(y_b-y_0)^2 = b^2\\ (x_c-x_0)^2\cos^2\alpha+(y_c-y_0)^2 = b^2\\ $$ Solving these you'll find the desired result $b$.

I inserted these equations into Mathematica and got the following results for $x_0$ and $y_0$: $$ x_0= \frac{\cos^2\alpha \left(x_a^2 (y_c-y_b)+x_b^2 (y_a-y_c)+x_c^2 (y_b-y_a)\right) -(y_a-y_b)(y_a-y_c) (y_b-y_c)} {2 \cos^2\alpha \left(x_a (y_c-y_b)+x_b (y_a-y_c)+x_c (y_b-y_a)\right)}\\ \phantom{x}\\ y_0= \frac{\cos^2\alpha (x_a-x_b)(x_a-x_c) (x_b-x_c)- \left(y_a^2 (x_c-x_b)+y_b^2 (x_a-x_c)+y_c^2 (x_b-x_a)\right)} {2 \left(x_a (y_c-y_b)+x_b (y_a-y_c)+x_c (y_b-y_a)\right)}\\ $$ Plug these into one of the three equations above to get $b^2$.

EDIT.

Let's take, as an example, the data given in the question. From: $$ P_1 = (-25, 0, 25),\quad P_2 = (0, -25, 15),\quad P_3 = (25, 0, 13) $$ one gets the equation of plane $P_1P_2P_3$: $$ {6\over25}x-{4\over25}y+z=19. $$ Its intersection with plane $z=0$ is then the line $l$ in the $(x,y)$ plane with equation: $$ {6\over25}x-{4\over25}y=19. $$ From the coefficients of $x$ and $y$ we get the angle $\phi$ between $l$ and $y$-axis: $$ \cos\phi={6/25\over\sqrt{(6/25)^2+(-4/25)^2}}={3\over\sqrt{13}}, \quad \sin\phi={-4/25\over\sqrt{(6/25)^2+(-4/25)^2}}=-{2\over\sqrt{13}}. $$ Starting with $$ \begin{align} &x_a = -(9.51 + 25) \sin62°,\quad y_a = -(9.51 + 25) \cos62°,\\ &x_b = 0,\quad y_b = -(8.71 + 25),\\ &x_c = (15.273 + 25) \sin62°,\quad yc = -(15.273 + 25) \cos62°, \end{align} $$ we can compute the coordinates in the new axes: $$ \pmatrix{x_a'\\y_a'}= \pmatrix{\cos\phi &\sin\phi\\-\sin\phi & \cos\phi} \pmatrix{x_a\\y_a}=\pmatrix{-16.3661\\ -30.3824} $$ and so on for points $P_b$ and $P_c$. We can now insert the new coordinates into the formulas given above, to find: $$ x_0 = -1.44189,\quad y_0 = 6.95721,\quad b=39.9981. $$ Diameter $2b$ of the circle is very near to $80$.

Intelligenti pauca
  • 50,470
  • 4
  • 42
  • 77
  • Thank you for your answer! Sadly I am not getting the expected result of 80 mm when i sub in the CAD measurments. Ive edited the question with the wolfram mathematica code Im running. Do you see any errors in my attempt? Thanks again for your time! – Msegling Oct 21 '23 at 17:35
  • @Msegling But did you rotate the coordinate axes, as explained above? When I have some time I'll add a worked out example. – Intelligenti pauca Oct 21 '23 at 18:13
  • 1
    Appreciate the detailed answer! Thanks again. – Msegling Oct 21 '23 at 21:43
2

Follows a MATHEMATICA script which evaluates the radius of a 3D circle, according to an indicated vector formula. The probe can be represented by

$$ p_{bore}(\theta,r)= p_0 + r\left(\vec u\cos\theta+\vec v\sin\theta\right) $$

where

$$ \cases{ \vec n = (P_2-P_1)\times(P_3-P_2)\\ \vec u\cdot\vec n = \vec v\cdot\vec n=\vec u\cdot\vec v=0\\ \|\vec u\| =\|\vec v\| = 1 } $$

p1 = {-25, 0, 25};
p2 = {0, -25, 15};
p3 = {25, 0, 13};
rm = 25;
n = Cross[p2 - p1, p3 - p2];
u = {ux, uy, uz};
v = {vx, vy, vz};
soluv = Solve[{n.u == 0, n.v == 0, u.v == 0, u.u == 1, v.v == 1, vz == 0}, {ux, uy, uz, vx, vy, vz}][[4]]
p0 = {x0, y0, z0};
pbore[t_, r_] := p0 + r (u Cos[t] + v Sin[t]) /. soluv

pa = pbore[0, rm + 9.322]; pb = pbore[62/180 Pi, rm + 9.988]; pc = pbore[2 62/180 Pi, rm + 15.603];

r = 1/2 Sqrt[(pa - pb).(pa - pb) (pc - pa).(pc - pa) (pb - pc).(pb - pc)/Cross[pb - pa, pc - pb].Cross[pb - pa, pc - pb]]

The result giving $r=40.0001$ and the diameter $2r=80.0002$. It happens that the circle whose diameter is $80.0002$ is not guaranteed to be on an horizontal plane, that I suppose, the bore is perpendicular to. Note that due to the differences between vectors, p0 is eliminated.

Cesareo
  • 33,252