Find the coordinate of two line segments that are perpendicular

884 Views Asked by At

How can the x,y position (actually will need in 3d but for simplicity asking in 2d) of a point be found if it is the intersection of two perpendicular line segments.

I have two points, $p_1$ and $p_2$ that are known $x,y$ locations. I also have line segments with known lengths $a$ and $b$. I made a diagram below to illustrate the problem.

enter image description here

4

There are 4 best solutions below

3
On BEST ANSWER

If you draw a circle with diameter $\sqrt{a^2+b^2}$ then $p_3$ can be either of two points on that circle.

In two dimensions...

Let $\vec i$ be the unit vector in the direction of the vector $\overrightarrow{p_1p_2}=\dfrac{p_2-p_1}{|p_2-p_1|}$ Let $\vec j$ be a unit vector perpendicular to $\vec i$. (If $\vec i = \langle u,v\rangle$, then, for example, $\vec j = \langle-v, u\rangle$.) Then

$$\overrightarrow{p_1p_3} = \dfrac{a^2}{\sqrt{a^2+b^2}} \ \vec i \pm \dfrac{ab}{\sqrt{a^2+b^2}} \ \vec j$$

See here for details.

In three dimesions, there will be a circle of possible points.

$$\overrightarrow{p_1p_3} = \dfrac{a^2}{\sqrt{a^2+b^2}} \ \vec i + \dfrac{ab}{\sqrt{a^2+b^2}}\cos(\theta) \ \vec j + \dfrac{ab}{\sqrt{a^2+b^2}}\sin(\theta) \ \vec k$$

2
On

Sometimes a figure is worth a 1000 words:

enter image description here

In three dimensions:

enter image description here

0
On
  • Let $\ell$ be the distance between $p_1$ and $p_2$, and let $p_3$ be the point where the two line segments will meet.

  • The three points $p_1, p_2, p_3$ form a triangle whose side lengths we know: $a, b, \ell$.

  • We can find out where $p_3$ is by measuring properties of this triangle. Draw a perpendicular altitude from $p_3$ down to the side of the triangle between $p_1$ and $p_2$. Call the intersection point $p_4$.

  • If we knew the length $h$ of this altitude, we would know where to put $p_3$. First, we could find out where $p_4$ is. By the Pythagorean theorem, the distance between $p_1$ and $p_4$ is $\sqrt{a^2 - h^2}$. So $$p_4 = p_1 + \frac{\sqrt{a^2-h^2}}{\ell} (p_2 - p_1)$$

    Next, we would use $p_4$ to find out where to put $p_3$. We start from $p_4$ and travel a distance $h$ in a direction perpendicular to the $p_1$ $p_2$ base of the triangle.

    In two dimensions, we have two choices of perpendicular direction. In three dimensions, we actually have an infinite number of perpendicular directions[*], so you'll have to pick one. Pick a unit vector $\widehat{u}$ in a perpendicular direction.

    Then $p_3 = p_4 + h\cdot \widehat{u}$, which gives you the answer you want.

  • But how do we find $h$? We can find $h$ if we know the area of the triangle. Heron's formula lets you calculate the area of the triangle when you know the length of all the sides. $A = \sqrt{s(s-a)(s-b)(s-\ell)}$, where $s$ is half the perimeter $s = (a+b+\ell)/2$. Once you have the area, you can calculate the height of the altitude: $A = \frac{1}{2}\text{base}\times\text{height}$, so $h = 2A/\ell$.

[*] In 3D, you have an infinite number of perpendicular directions. Imagine $p_1=\langle 0,0\rangle$ and $p_2 = \langle 1,0\rangle$, and $a$ and $b$ are some numbers. There's a satisfactory point $p_3$ in the x-y plane. But if you spin $p_3$ around the $x$-axis, you find an infinite number of other satisfactory points too.

0
On

As I mentioned in my comment, there is no solution unless $a^2+b^2=\lvert P_1P_2\rvert^2$. Let $Q$ be the point $(x_3,y_3)$, $R$ the foot of the perpendicular from $Q$ to $\overline{P_1P_2}$, and $c = \lvert P_1P_2\rvert$. $\triangle{P_1QP_2}$, $\triangle{P_1RQ}$ and $\triangle{QRP_2}$ are all similar, therefore $\lvert P_1R\rvert = a^2/c$, which means that $$R = \left(1-{a^2\over c^2}\right)P_1+{a^2\over c^2} P_2.$$ Similarly, $\lvert QR\rvert = (ab)/c$ and a unit vector perpendicular to $\overline{P_1P_2}$ is $\frac1c(y_1-y_2,x_2-x_1)$, therefore the two solutions are $$Q=R\pm{ab\over c^2}(y_1-y_2,x_2-x_1).$$

In three dimensions, there is an infinite number of solutions that lie on a circle of radius $(ab)/c$ centered at $R$ and in a plane perpendicular to $\overline{P_1P_2}$.