0

I have a 2D line (L1, at an arbitrary slope) and a point on that line (P1). I want to find another point (P2) away from L1. I know the distance (d) from L1 and the angle (theta) between the lines. (Not labeled but the 2nd line would be from P1 to P2.) How do I calculate the other point (P2)? (See image for more info.)

Given a Line (L1), a Point (P1), and the Angle (theta) and Distance (d) from L1. Find the other point (P2).

This should be fairly easy but I've forgotten most of my high school geometry. :(

tvwxyz
  • 103
  • 3

1 Answers1

0

To find the point $P_2$ you can first find a point $P_2'$ in $L_1$ at a distance $d$ from $P_1$.

To find $P_2'$ you can first find another point, say $P_1'$, in $L_1$.

Consider $P_1 = (x, y_1)$, and $P_1' = (x + 1, y_2)$. You can find $y_2$ thinking in a right triangle of base $(x + 1) - x = 1$ and height $y_2 - y_1$ (supposing $y_2 > y_1$, the other case is analogous), which gives $\tan \alpha = \dfrac{y_2 - y_1}{1}$, where $\alpha$ is the angle that $L_1$ makes with the x-axis.

Now you can find $P_2'$ as explained here.

Now to find $P_2$ you can rotate $P_2'$ by $- \theta$ around $P_1$, as explained here.

Tiago Cavalcante
  • 390
  • 1
  • 10