Calculate Points in Right Angle to Line

270 Views Asked by At

Given two points(blue) A(1,1) and B(3,3) I need to calculate the coordinates of two new points(orange) which are in an right angle to line AB and a certain distance from point A.

So far, I've calculated the angel to X-axis (45°) with Arctan(1/1).

I calculated the coordinates of the new points as follows:

X = (sin(45° + 90°) * Distance) + X Y = (sin(45° + 270°) * Distance) + Y

However, this is wrong. How would I calculate the coordinates of the points shown in organge?

enter image description here

2

There are 2 best solutions below

2
On BEST ANSWER

Refer to the graph:

$\hspace{2cm}$enter image description here

$$\begin{cases}x_1=1-d\cos{45^\circ}=1-\frac{d}{\sqrt{2}} \\ y_1=1+d\sin{45^\circ}=1+\frac{d}{\sqrt{2}}\end{cases}$$ Similarly, can you find the coordinates of the second orange point?

0
On

Hints (fill in details):

Slope of $\;AB\;$ is $\;\cfrac{3-1}{3-1}=1\;$ , so orange points are on the line with slope $\;-1\;$ which pases through $\;A(1,1)\;$

Thus, you need two points on the line $\;y-1=-(x-1)\implies y=-x+2\;$, and thus their general form is $\;(a, -a+2)\;$, and to a certain distan $\;d\;$ from $\;A(1,1)\;$, thus solve the equation

$$(a-1)^2+(-a+1)^2=d^2\iff2(a-1)^2=d^2\implies\ldots$$