3

Given:
- 3 3-dimensional straight lines: a, b, c. All lines are coninciding in a single point S.
- Point B on b.

I'm now looking for a point A on a and a point C on c, where AB and BC have the same length and the angle ABC is 90 degrees.

I think this should be solvable with the law of sines. I know the angle BSC and distance SB and should be able to set up 2 equations with 2 unknowns: Length BC and the angle SBC - if I can express the angle SBA with SBC and the 90 degrees of ABC. I'm not sure how to express this angle in this (3D) case, though.

Thanks a lot for any help,
Patrick

Sketch 1 Sketch 2

Pat8
  • 133

2 Answers2

3

Instead of trigonometry I think a simpler approach is using parametric equations and dot products for orthogonality and distance constraint:

Let's place $S$ in the origin, without losing any generality.

The line $A$ can be defined as $A(s)=sa$ where $s$ is a real number and $a$ is a vector with $|a|=1$.

In analogy let's define $C$ to be $C(t)=tc$ with $t$ real and $|c|=1$.

The requirement of $A(s)$ and $C(t)$ being at the same distance from $B$ can be expressed as

\begin{equation} |A(s)-B|^2 = |C(t)-B|^2 \end{equation}

\begin{equation} (sa-B)\cdot(sa-B) = (tc-B)\cdot(tc-B) \end{equation}

\begin{equation} s^2|a|^2 + |B|^2 - 2s(a \cdot B) = t^2|c|^2 + |B|^2 - 2t(c \cdot B) \end{equation}

\begin{equation} s^2 - 2s(a \cdot B) = t^2 - 2t(c \cdot B) \end{equation}

The second requirement of perpendicularity can be expressed as

\begin{equation} (A(s) - B) \cdot (C(t) - B) = 0 \end{equation}

\begin{equation} (sa - B) \cdot (tc - B) = 0 \end{equation}

\begin{equation} st(a \cdot c) + |B|^2 -s(a\cdot B) -t(c\cdot B) = 0 \end{equation}

Solving this last equation for $s$ gives

\begin{equation} s = {t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)} \end{equation}

Substituting this expression $s=s(t)$ into the equidistance condition finally gives the equation:

\begin{equation} \left({t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)}\right)^2 - 2 \left({t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)}\right)(a\cdot B) = t^2 - 2t(c \cdot B) \end{equation}

This is a 4th degree equation in $t$ than when solved provides the solutions. Experimentally I've been able to build cases in which there are 0, 1, 2, 3 or 4 real solutions and therefore I suppose that a closed formula is not going to be really simple.

For a case in which there are 4 distinct solutions consider for example:

a = (0.7832613199545745, 0.3457501646810926, -0.5166802960110005)
b = (0.22437668770758193, -0.7218976823125938, 0.6546135029810183)
c = (-0.4162213502972967, -0.02495946801502962, -0.9089206854908198)
B = (10.598100181328936, -34.09776673318595, 30.91969827848149)

The solutions are (approximately):

s = -324.127866359 , t = -337.34963584
    A = (-253.87682043855557, -112.06726317141957, 167.47048193587798)
    C = (140.41212095172617, 8.42006744563637, 306.62406225798975)
    |A - B| = 307.688710435
    |C - B| = 307.688710435
    (A - B)·(C - B) = -2.18278728426e-11

s = 16.2368805029 , t = -75.2329758241
    A = (12.717720454640398, 5.613904107782358, -8.389276224529821)
    C = (31.313570784400618, 1.8777750537577107, 68.38080795757674)
    |A - B| = 55.9169479457
    |C - B| = 55.9169479457
    (A - B)·(C - B) = 6.8212102633e-13

s = -31.0680366312 , t = -59.2027780354
    A = (-24.334391380153313, -10.741778781556734, 16.05224236309069)
    C = (24.641460215247356, 1.4776698447755863, 53.81062959490106)
    |A - B| = 44.5737858532
    |C - B| = 44.5737858532
    (A - B)·(C - B) = 0.0

s = -169.123690271 , t = 120.065787347
    A = (-132.46804487704648, -58.47454376258159, 87.38287835155742)
    C = (-49.973944134014694, -2.996778178983093, -109.13027773929545)
    |A - B| = 155.724885051
    |C - B| = 155.724885051
    (A - B)·(C - B) = 9.09494701773e-13
6502
  • 344
2

This is a complete rewrite, since my first solution involved an algebraic curve of degree three, and likely roots of a sixth degree polynomial. This here should be far easier.

You can describe the problem using three vectors $a,b,c\in\mathbb R^3$ such that each vector gives the direction of one of the lines, and furthermore $b=B-S$, i.e. it points exactly at point $B$. For the other two, the length of the vector does not matter. Then you can assume $A=S+\lambda\,a$ and $C=S+\mu\,c$ for some $\lambda,\mu\in\mathbb R$.

Now you have two conditions:

$$\langle A-B,C-B\rangle=0 \qquad \lVert A-B\rVert=\lVert C-B\rVert$$

where $\langle\cdot,\cdot\rangle$ denotes the dot product. You can write the first of these conditions, the right angle, as

\begin{align*} \langle A-B,C-B\rangle&=0 \\ \langle A,C\rangle - \langle A,B\rangle - \langle C,B\rangle + \langle B,B\rangle&=0 \\ \lambda\mu\,\langle a,c\rangle - \lambda\,\langle a,b\rangle - \mu\,\langle c,b\rangle + \langle b,b\rangle&=0 \\[2ex] (\lambda, \mu, 1)\cdot \begin{pmatrix} 0 & \langle a,c\rangle & -\langle a,b\rangle \\ \langle a,c\rangle & 0 & -\langle c,b\rangle \\ -\langle a,b\rangle & -\langle c,b\rangle & 2\,\langle b,b\rangle \end{pmatrix} \cdot\begin{pmatrix}\lambda\\\mu\\1\end{pmatrix} &=0 \end{align*}

The second condition, the equal length, can also be written as

\begin{align*} \lVert A-B\rVert^2 - \lVert C-B\rVert^2 &= 0 \\ \langle A-B,A-B\rangle - \langle C-B,C-B\rangle &= 0 \\ \langle A,A\rangle - 2\,\langle A,B\rangle - \langle C,C\rangle + 2\,\langle C,B\rangle &= 0 \\ \lambda^2\,\langle a,a\rangle - 2\lambda\,\langle a,b\rangle - \mu^2\,\langle c,c\rangle + 2\mu\,\langle c,b\rangle &= 0 \\[2ex] (\lambda, \mu, 1)\cdot \begin{pmatrix} \langle a,a\rangle & 0 & -\langle a,b\rangle \\ 0 & -\langle c,c\rangle & \langle c,b\rangle \\ -\langle a,b\rangle & \langle c,b\rangle & 0 \end{pmatrix} \cdot\begin{pmatrix}\lambda\\\mu\\1\end{pmatrix} &=0 \end{align*}

Now you can interpret each of the quadratic equations as a description of a conic section in the projective plane. You can then apply the machinery for intersecting conics, which will involve solving a cubic equation. In the end, you obtain up to four points of intersection, from which you can deduce possible solutions for $A=S+\lambda\,a$ and $C=S+\mu\,c$.

MvG
  • 42,596
  • Thanks so much for this elaborate answer. Unfortunately it's way over my head. I added a paragraph to my post where I try to describe a hunch - that all of this could be solved with the law of sines and two equations involving to some trigonometry which would be closer to my math level. If this is not the case, please don't take this comment the wrong way - I'm very happy for any help. But I'm a designer first and this problem relates to one of my projects. – Pat8 Feb 08 '14 at 08:41
  • @Pat8: I completely rewrote my answer, since the original approach turned out to be more complicated than I anticipated. This one here should be far easier: now it's two equations in two unknowns. On the downside, the equations are quadratic, not linear, which still requires some work. On the upside, no trigonometric functions are involved, in particular none which include one of the variables in their argument. – MvG Feb 08 '14 at 08:58
  • I was hoping for a final set of formulas I can apply directly (will be used in code) - if this forum is the wrong place for completely spelled out solutions, my bad, sorry. In any case, thank you for your help. – Pat8 Feb 11 '14 at 20:02
  • @Pat8: I could do most of the computation symbolically, but the resulting formulas would cover several screen pages. Mostly due to the high amount of uglyness involved in solving cubic equations. And it would fail in some corner cases, due to the fact that the solution has to choose a non-zero element of a matrix at some point, and you can't make that decision symbolically. So I'd advise against a formula as the final result, and would advise an algorithm instead. Search the web for implementations of conic-conic intersections for your language of choice, perhaps ask on Stack Overflow. – MvG Feb 11 '14 at 21:16