Geometry – Finding the Diameter of a Circle Projected on a Plane

circleseuclidean-geometrygeometryprojective-geometrytrigonometry

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$?


Best Answer

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$.