0

I'm trying to find a real world coordinate where 3 spheres collide and interact. At the moment I have been able to set up my triangulation equations so that I can work out the 2D position of where my 3 spheres collide but I'm stuck trying to find the height of where they collide. What would the equation for this be?

Following the rather obtuse comment I'll provide images to try and clear things up.

enter image description here The picture above represents my triangulation of 3 intersecting spheres in 2D space. This is the known. What I'm trying to do is find is now find the height in which all 3 intersect. The below picture is my best attempt at re-creating this.

enter image description here

There are no known variables in this equation. Given that I have already worked out the 2D triangulation of my intersecting points, what do I need to do so I can work out the 3D coordinates of my spheres?

  • The hypotenuse of a right triangle formed by the hypotenuse of another plus a height has length equal to the square root of the sum of the squares of this height and the two legs of the other triangle. Perhaps you could give us a picture so we can help more easily? – abiessu Oct 07 '13 at 12:46

2 Answers2

1

You have three equations to solve (assuming you know the centre and radius of each sphere).
$(x-a)^2+(y-b)^2+(z-c)^2=r^2\\(x-A)^2+(y-B)^2+(z-C)^2=R^2\\(x-\alpha)^2+(y-\beta)^2+(z-\gamma)^2=\rho^2$
By subtracting one equation from the other two, you get two linear equations in $x,y,z$. The solution to that is generally a straight line, that can be parametrized by a single variable $t$. Put that solution back into any of the three quadratic equations, and you get one quadratic equation in $t$.

Empy2
  • 50,853
0

OP indicates they already know the location of the point where the three spheres intersect, projected to the plane through the three sphere centers; only the distance $w$ from the plane to the intersection is unknown.

Simply put, the distance $w$ is the difference between the sphere radius and the distance from the projected point to the center of that sphere, using any of the three spheres.

Let $(x_p, y_p, z_p)$ be the point on the plane, $r_1$ be the radius of one of the spheres, and $(x_1, y_1, z_1)$ be the center of that sphere. Then, $$w = \sqrt{ r_1^2 - (x_p - x_1)^2 - (y_p - y_1)^2 - (z_p - z_1)^2 }$$


Here is the full trilateration procedure:

Let's say you have three spheres with radii $r_1$, $r_2$, and $r_3$, centered at $\vec{c}_1 = ( x_1 , y_1 , z_1 )$, $\vec{c}_2 = ( x_2 , y_2 , z_2 )$, and $\vec{c}_3 = ( x_3 , y_3 , z_3 )$.

To simplify the problem, we rotate the spheres so that their centers lie on the $x y$ plane, and translate so that the center of the first sphere is at origin $(0, 0, 0)$, the center of the second sphere is on the positive $x$ axis at $(u_2, 0, 0)$ with $u_2 \gt 0$, and the center of the third sphere is at $(u_3, v_3, 0)$, with $v_3 \gt 0$.

To make it clearer which orientation is involved, I'll use $x$, $y$, and $z$ for the original 3D coordinates, and $u$, $v$, $w$ for the rotated 3D coordinates.

Note that if $u_2 = 0$, the first and second sphere are centered on the same point, and there is either no solution, or an infinite number of solutions (a circle instead of one or two points).

Similarly, if $u_3 = v_3 = 0$, the first and third spheres are centered on the same point. If $v_3 = 0$ (but $u_3 \ne 0$), the three sphere centers are collinear, and again there is either no solution, or the solutions form a circle.

In the sane, non-degenerate cases, $u_2 \gt 0$ and $v_3 \gt 0$, and that is what we assume here.

We can obtain the unit axis vectors for the rotated coordinate system, $\hat{u}$, $\hat{v}$, and $\hat{w}$, from the vectors between the sphere centers, using the Gram-Schmidt process: $$\begin{aligned} \vec{d}_{12} &= \vec{c}_2 - \vec{c}_1 \\ \vec{d}_{13} &= \vec{c}_3 - \vec{c}_1 \\ L_{12} &= \sqrt{\left\lVert \vec{d}_{12} \right\rVert} \\ L_{13} &= \sqrt{\left\lVert \vec{d}_{13} \right\rVert} \\ \hat{u} &= \frac{\vec{d}_{12}}{L_{12}} \\ \vec{v} &= \vec{d}_{13} - \hat{u} ( \hat{u} \cdot \vec{d}_{13} ) \\ \hat{v} &= \frac{\vec{v}}{\left\lVert \vec{v} \right\rVert} \\ \hat{w} &= \hat{u} \times \hat{v} \\ \end{aligned}$$ Note that this rotated coordinate system is right-handed. (Its handedness doesn't actually matter; I only bring it up because if your original coordinate system is left-handed, then this new coordinate system is a generalized rotation that involves mirroring one of the axes, instead of a pure rotation.)

Note that in the original coordinate system, $$\begin{aligned} \vec{c}_2 &= \vec{c}_1 + u_2 \hat{u} \\ \vec{c}_3 &= \vec{c}_1 + u_3 \hat{u} + v_3 \hat{v} \\ \end{aligned}$$ Because the Gram-Schmidt process makes sure that $\hat{u}\cdot\hat{v} = 0$, we directly obtain the sphere center coordinates in the rotated coordinate system from the above: $$\left\lbrace \begin{aligned} u_2 &= L_{12} \\ u_3 &= \hat{u} \cdot \vec{d}_{13} \\ v_3 &= \hat{v} \cdot \vec{d}_{13} \\ \end{aligned} \right.$$

Because the three spheres are on the $u v$ plane, the two points where all three spheres intersect are $(u, v, \pm w)$, and $$\left\lbrace \begin{aligned} u^2 + v^2 + w^2 &= r_1^2 \\ (u - u_2)^2 + v^2 + w^2 &= r_2^2 \\ (u - u_3)^2 + (v - v_3)^2 + w^2 &= r_3^2 \\ \end{aligned} \right.$$ The first of the three simultaneous equations restricts the intersection point to the shell of the first sphere, the second to the shell of the second sphere, and the third to the shell of the third sphere. The solution to this system of equations is $$\left\lbrace \begin{aligned} u &= \frac{r_1^2 - r_2^2 + u_2^2}{2 u_2} \\ v &= \frac{r_1^2 - r_3^2 + L_{13}^2 - 2 u_3 u}{2 v_3} \\ w &= \sqrt{r_1^2 - u^2 - v^2 } \\ \end{aligned} \right.$$ and the three spheres intersect at $$\vec{c}_1 + u \hat{u} + v \hat{v} \pm w \hat{w}$$ in the original coordinate system.