2
$\begingroup$

I have two circles in 3D specified by their centers, $c_1, c_2$, their radii, $r_1, r_2$, and the normals of the plane each circle is embedded in, $n_1, n_2$. Note that $n_1$ is not necessarily parallel to $n_2$.

I wish to find the points $p_1$ on the first circle and $p_2$ on the second such that $|p_1p_2|$ is maximized.

How do I do this?

$\endgroup$
1
$\begingroup$

Define the equations for each circle parametrically, $f_1(t_1) = (a(t_1), b(t_1), c(t_1))$, and similarly for $f_2(t_2)$. It's important to use to different independent variables.

Use $f_1$ and $f_2$ to define a distance function between the two circles at time $t_1, t_2$. Find where the derivative of this distance function with respect to $t_1$ is zero. This will give you a set of critical points for any particular $t_2$.

Now take this function and take the derivative with respect to $t_2$ and find where this is zero.

This will give you points that are critical for both $t_1$ and $t_2$ (these derivatives can technically be taken in the opposite order, as well). This will give you maximum and minimum points, and possibly some other critical points such as inflection points. You'll have to test this set of points to see which is which.

The solutions will be periodic, so you can restrict your attention to those points between $[0, 2\pi]$, or whatever one period is depending on your parameterization.

$\endgroup$
0
$\begingroup$

Let's see if this helps. Let $\mathbf{x}_1 = (x_1,y_1,z_1)$ and $\mathbf{x}_2 = (x_2,y_2,z_2)$ be two points lying on the circles 1 and 2, respectively. Then, the parametric equations for these points are given by (see here for a derivation):

\begin{align} \mathbf{x}_1 & = \mathbf{c}_1 + r_1 (\cos \theta \, \mathbf{a} + \sin \theta \,\mathbf{b}),\\ \mathbf{x}_2 & = \mathbf{c}_2 + r_2 (\cos \lambda \, \mathbf{p} + \sin \lambda \,\mathbf{q}), \end{align} for $\theta, \lambda \in [0,2\pi)$. The way to compute the unit vectors $\mathbf{a}$ and $\mathbf{b}$ and $\mathbf{p}$ and $\mathbf{q}$ from $\mathbf{n}_1$ and $\mathbf{n}_2$ is explained in the link above. Now, the distance between points pertaining to each circle is given by:

$$ d(\mathbf{x}_1,\mathbf{x}_2) = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2 + (z_1 - z_2)^2}, $$ which depends exclusively on $\theta$ and $\lambda$. This will become your function to maximize, or more conveniently $d^2$. The set of critical points is then given by the equation:

$$ \partial_\theta d^2 = 0, \quad \partial_\lambda d^2 = 0,$$ i.e., the gradient of $d^2$, with respect to the independent variables, $\theta$ and $\lambda$, must be zero (necessary condition for optimality).

Edit. This is definitely wrong: I don't know if setting $\lambda = \theta$, in order to make $d$ only dependent on one variable, makes any sense, since there's no restriction for doing that (I strongly think that this is not legit).

Hope this helps.

Cheers.

$\endgroup$
4
  • 1
    $\begingroup$ Note that the problem you've posed may not have a unique solution (e.g., two radius=1 circles parallel to the $xy$-plane, with centers along the $z$-axis: there are infinitely many point-pairs that maximize the distance. The same thing happens for two concentric circles in any plane. $\endgroup$ – John Hughes Jun 11 '14 at 15:24
  • $\begingroup$ Ok, writing out those gives me two equations of the form $0=A\cos\theta+B\sin\theta+C\cos\gamma+D\sin\gamma+E\cos\theta\sin\gamma+F\cos \theta\cos\gamma+G\sin\theta\cos\gamma+H\sin\theta\sin\gamma$. I can do half-angle substitutions on those, but I still end up with two equations that involves fourth degree polynomials of two variables. I was kind of hoping there was a way to avoid this. $\endgroup$ – RFon Jun 12 '14 at 20:43
  • $\begingroup$ I was wrong. Doing the half-angle subsitution gives two equations of the form $0 = At^2s^2 + Bt^2s + Cts^2 + Dts + Et^2 + Fs^2 + Gt + Hs + I$ where $A\ldots I$ are constants and $t=\tan\frac{\theta}{2}$ and $s=\tan\frac{\lambda}{2}$. I can solve the first wrt. $t$ and then put those solutions into the second and solve wrt. $s$. That should give me up to four solutions for $s$ and $t$. @Dmoreno Why would I not be able to use those solutions to get $\theta$ and $\lambda$? $\endgroup$ – RFon Jun 13 '14 at 9:27
  • 1
    $\begingroup$ I'm sorry I cannot give you a complete answer right now, but that would be the standard way to go, as @cnick points out in his comment. But then I don't understand your last question. $\endgroup$ – Dmoreno Jun 13 '14 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.