Calculate sphere radius using two vector points.

2.5k Views Asked by At

Using accelerometers I have acquired two $3D$ vectors $V_1$, $V_2$ which both have $(x, y, z)$.

Assume that these vectors are points ($P_1$ and $P_2$) on the surface of a sphere ($S$), so that the vector is perpendicular to the surface. Also assume that $P_1$ and $P_2$ are on the same hemisphere of the surface. The distance between $P_1$ and $P_2$ is static: $d=0.2m$.

How do I calculate the radius/diameter of the sphere?

In context: two accelerometers provide the data for $V_1$ and $V_2$. They are positioned on the chest ($P_1$ and $P_2$), the chest is the sphere, the distance between the accelerometers ($d=0.2m$) is static and breathing causes the accelerometers to 'rotate' (and thus changing the vectors).

1

There are 1 best solutions below

1
On BEST ANSWER

TL;DR $r = \frac{d}{\sqrt{2(1-\cos\theta)}}$ where $\theta$ is the angle between the two vectors

If I got your problem right, here is how you do it.

You have: two vectors $V_1,V_2$ perpendicular to the surface of the sphere, and the distance $d$ between the two points at the bases of the vectors. You want to calculate the radius $r$ of the sphere.

Imagine the two points lying on a circle in the $xy$-plane (a section of the sphere) with the origin at the centre of the circle, an place one of the two points on the $x$-axis.

With a little trigonometry, you will see that $d$ is the hypothenuse of a triangle with sides $r\sin\theta$ and $r-r\cos\theta$, where $\theta$ is the angle between the lines connecting the two points with the origin. A little algebra yields the result.

You can calculate the cosine using the vectors and the formula for the dot product: $V_1 . V_2= |V_1| | V_2|\cos\theta$.