0

good day. Actually I'm stuck with this problem

I want to get the 2 points (vertex coordinates) in a 3d circle circle intersection circle circle intersection

actually I know a lot of data,

Circle 1 center  c1c = (-0.23103,-0.12451,1.78538)
Circle 2 center  c2c = (0.56227,1.38846, 2.82537)

Circle 1 radius*  c1r = 2
Circle 2 radius*  c2r = 2

Circle 1 point  c1p** = (-1.40115, -0.58086, 3.34184)
Circle 2 point  c2p** = (1.87197,   2.8998,  2.82537)

Circles plane normal***  Cn = (-0.7073, 0.6130, -0.3520)

*in this case both circles have the same radius, but this can change in other problems.

** Both additional points, each by his circle, are given randomly.

**** I calc the Circles plane normal Cn using the fourth points that I have (c1c, c2c, c1p,c2p).

Actually I'm trying to apply the math from http://paulbourke.net/geometry/circlesphere/ "Intersection of two circles" but that is only for 2D and I need for 3D; and for more that tried to calculate the Z axis not achieved.

Paul Bourke intersection of two circles

two years a go I ask some similar question that I solve using some advices and this triangle idea: Z coordinates of 3rd point (vertex) of a right triangle given all data in 3D , but today I don't have any data of new point, BUT I have the normal.

I get two posibble solutions:

the first one may be is all that I need, BUT mathematics is beyond me pitifully. The second one is conected with a software called Geometric Tools Engine and I can't get the math or the logic behind that solution.

can you help me with a clear and specific solution?, understanding that I am not a mathematician

thank you.

  • Solve it in 2-d and transform to the plane in 3-d. – amd Jun 07 '17 at 16:43
  • @amd thanks for comment... can be more specific please? may be this is evident to you... but not for me. thanks – Diego Quevedo Jun 07 '17 at 17:07
  • Following up on @amd 's comment, if everything lies in the same plane, you can rotate/translate/transform your 3D plane so that it coincides with the usual 2D plane $xOy$. That means you can transform your problem to 2D, solve it with 2D equations, then put everything back to 3D. On a side note, in the general case your 4 points may not be coplanar so the problem may not have a solution (with the way you phrased it at least). – N.Bach Jun 07 '17 at 17:46
  • @N.Bach thanks for comment.. I understand. but may be exist another option in order to avoid the 3d-2d-3d transformation? .. also .. Im sure both circles are in the same plane.... how do you test if the points are or not coplanars? thanks again – Diego Quevedo Jun 07 '17 at 17:55
  • There are many ways to solve this. You can obtain the parametric equations of the circle and solve the parametric system. I'm not too fond of this method in 3D. You can also see this as intersecting two spheres with the plane containing your 4 points. By manipulating the equations, this reduces to intersecting a 3D line with a sphere, which usually has simpler equations. For the coplanar test, from what you already have I suggest finding the equation of a plane with normal $Cn$ that goes through one of the four points, then testing if the remaining points are in the plane. – N.Bach Jun 07 '17 at 18:15
  • If performance/speed is an issue, there are better ways to test coplanarity depending on how you computed $Cn$. – N.Bach Jun 07 '17 at 18:17

3 Answers3

2

Let's assume you know the centers of the circles, $$\begin{array}{c} \vec{c}_1 = ( x_1 , y_1 , z_1 ) \\ \vec{c}_2 = ( x_2 , y_2 , z_2 ) \end{array}$$ their radiuses $R_1$ and $R_2$, respectively, and the unit normal of the plane the circles lie in, $$\hat{n} = ( x_n , y_n , z_n )$$

If you instead have a third point $\vec{p} = ( x_3 , y_3 , z_3 )$ (in addition to the centers), that you know is on the plane of the circles, and not collinear with the centers, you can calculate the plane unit normal using $$\vec{n} = \left ( \vec{c}_1 - \vec{p} \right ) \times \left ( \vec{c}_2 - \vec{p} \right ), \qquad \hat{n} = \frac{\vec{n}}{\lVert\vec{n}\rVert}$$

If $\vec{p}$ is collinear with the centers, then you'll just get $\vec{n} = 0$. Numerically, you should check that $\vec{n}\cdot\vec{n}$ is not too small, before trying to scale it to unit length.

We can use the two points and the unit normal to construct the unit vectors that represent the problem in planar coordinates. We can choose the first circle to be at origin $(0 , 0)$, and the second circle at $(1, 0)$, in which case the $x$ axis in three dimensions is $$\vec{e}_x = \vec{c}_2 - \vec{c}_1$$ and the $y$ axis is perpendicular to it and the plane normal, and just as long (to keep the circles circular), so $$\vec{e}_y = \vec{e}_x \times \hat{n}$$ Note that if $\hat{n}$ is not an unit vector ($\hat{n}\cdot\hat{n} = 1$), the latter scales the 2D $y$ axis, skewing the results. So we really do need $\hat{n}$ to be unit length.

In these new 2D coordinates, we need to scale the radiuses of the respective circles down: $$\begin{array}{c} d = \lVert \vec{c}_2 - \vec{c}_1 \rVert \\ r_1 = \frac{R_1}{d} \\ r_2 = \frac{R_2}{d} \end{array}$$

Finding the plane coordinates for the circle intersection points is now trivial (using e.g. the Wolfram MathWorld article on Circle-Circle Intersection): $$\begin{cases} x = \frac{1 + r_1^2 - r_2^2}{2} \\ y = \pm \frac{1}{2}\sqrt{4 r_1^2 - (1 + r_1^2 - r_2^2)^2} \end{cases}$$

Because the plane origin is at the first circle, and we know both $x$ and $y$ axes' 3D vectors, we can express the intersection points as $$\vec{p} = \vec{c}_1 + x \vec{e}_x \pm y \vec{e}_y$$

2

Define two unit vectors $v$ and $w$ as follows: $$ v={C_{2C}-C_{1C}\over|C_{2C}-C_{1C}|}, \quad w=C_n\times v. $$ You already know how to compute $a$ and $h$, so intersection points are given by: $$ C_{1C}+av\pm hw. $$

Intelligenti pauca
  • 50,470
  • 4
  • 42
  • 77
2

To expand on my comment, assume that circle 1 is centered on the origin and that circle 2’s center is at $(d,0,0)$ and that they lie in the $x$-$y$ plane. Then the formulas that you’re using to compute the intersection points reduce to $$P_\pm=(a,\pm h,0).$$ To transform this into your coordinate system, define the unit vectors $u={C_{2C}-C_{1C}\over\|C_{2C}-C_{1C}\|}$ and $v=C_n\times u$. Rotate the resulting intersection points using the matrix $R=\begin{bmatrix}u&v&n\end{bmatrix}^T$ (i.e., the matrix with these vectors as its rows) and add $C_{1C}$ to translate into position. The result is $$C_{1C}+au\pm hv$$ just as in Aretino’s answer. This is just a slightly more roundabout way to get there.

One way to test whether or not the four points that you start with are in fact coplanar is to compute the determinant $$\begin{vmatrix}C_{2C}-C_{1C}\\C_{1P}-C_{1C}\\C_{2P}-C_{1C}\end{vmatrix}.$$ If this is zero, then the points are coplanar.

amd
  • 53,693