# Vector Geometry - relation between a point and a line with angle and one known point on it

I have two problems I will be very grateful if somebody helps me about them. If I have a line $L_1$ with a known point $(x_1, y_1)$ on it and has slope $\theta_1$, how do I know if a point $P=(x, y)$ is right to it or left? Or upper or lower?

The second problem, if I get the distance between the previous point $P$ and the previous line $L_1$ as $d = \sqrt{(x-x_1)^2 + (y-y_1)^2}$, how can I relocate $P$ to a different line $L_2$ with a known point $(x_2, y_2)$ on it and has slope $\theta_2$ keeping the same distance between the new point and $L_2$, so what's the new $(x, y)$ for point $P$?

I don't have much experience in Vectors and any help will be much appreciated.

Many thanks,

Thank you guys for the help, I have attached an image to clarify my second problem. I want to get the red point location which should be located at the same distance and side and angle to L2. It's more like transferring L1 and P to another location as if P is attached to the line and transferred with it. I know my terms is not scientific at all but I will try my best to understand. Many thanks again. http://i.stack.imgur.com/15Ja1.jpg

-
I edited your question. Check if this is what you would like to ask. Especially I think what you meant by "angle" is "slope". – Paul Dec 24 '11 at 14:07
First problem: take two points on the line, and consider the triangle formed by those two points and the given point. Compute the signed area. Check the sign to see if the point is on the line's left or right. – J. M. Dec 24 '11 at 14:32
Please elaborate your question 2 so that I can understand it. There seems to be too many things happening. – user21436 Dec 24 '11 at 16:27
Your figure doesn't quite tell anything. According to you, you have a line $L_1$ and a point $P$ associated with it. You shift and rotate the point and line together to a new location. Is this right? – user21436 Dec 24 '11 at 18:12

## Problem 1

Let the given point $(x_1,y_1)$ be denoted by $A_1$.

Find the equation of the line $L_1$, which you can do by the following equation. $$y=\tan \theta_1.x + y_1-\tan \theta_1.x_1$$

Now consider any other point $B_1(x_3,y_3)$ on this line, (you can find this plugging in $x_3$ (different from $x_1$ and less than $x_1$) in to the equation above). Now consider the signed area of the triangle $\Delta PA_1B_1$

$$\Delta = \dfrac{1}{2}(x(y_1-y_3)+x_1(y_3-y)+x_2(y-y_1))$$

It is known that this area will turn out to be positive only when $P$, $A_1$, $B_1$ are taken in anticlockwise direction. From the figure, (please draw it in your mind), it is clear that if this area is positive, the point lies below the line $L_1$.

The other way, probably the easier way might be, to look at the sign of the value returned by $f=y-\tan \theta_1.x_1-y_1+\tan \theta_1.x_1$. This value is positive if the point lies above the line and negative, otherwise.

## Problem 2

If you get the distance $d$ from $P$ to $A_1$ as that you have mentioned, it means the perpendicular from $P$ intersects $L_1$ at $A_1$.

You can relocate the point $P$ by shifting the origin suitably.

-
I'll elaborate answer 2 once I get some clarification from OP. Please forgive me for the short coming. – user21436 Dec 24 '11 at 16:31
Hi Kannappan Sampath, I have edit my question. Thank you for your help. – ramyadel Dec 24 '11 at 18:00
1. Try writing an equation for the line $L_1$ of the form $ax+by-c=0$. In your case, this would be $x+\theta_1 y-x_1-\theta_1 y_1=0$. A point $(x,y)$ then lies above the line if $\operatorname{sgn}(x+\theta_1 y-x_1-\theta_1 y_1) = \operatorname{sgn}(\theta_1)$, below the line if $\operatorname{sgn}(x+\theta_1 y-x_1-\theta_1 y_1) = -\operatorname{sgn}(\theta_1)$, to the right of the line if $x+\theta_1 y-x_1-\theta_1 y_1 > 0$ and to the left if $x+\theta_1 y-x_1-\theta_1 y_1 < 0$.

2. This can be set up as the solution to a pair of equations. A point $(x,y)$ lies on $L_2$ if and only if $x+\theta_2 y-x_2-\theta_2 y_2=0$, while it has distance $d$ from $L_1$ if and only if $d=\frac{|x+\theta_1 y-x_1-\theta_1 y_1|}{\sqrt{1+\theta_1^2}}$. There are at most two solutions to this, one being the solution to $$\begin{matrix} x+\theta_2 y=x_2+\theta_2 y_2\\ x+\theta_1 y=x_1+\theta_1 y_1 + d\sqrt{1+\theta_1^2} \end{matrix}$$ which corresponds to the expression within the absolute value being positive, and $$\begin{matrix} x+\theta_2 y=x_2+\theta_2 y_2\\ x+\theta_1 y=x_1+\theta_1 y_1 - d\sqrt{1+\theta_1^2} \end{matrix}$$ which corresponds to the expression within the absolute value being negative. The solutions to these are $$\begin{pmatrix}x\\ y\end{pmatrix} = \begin{pmatrix}1 & \theta_2\\ 1 & \theta_1\end{pmatrix}^{-1}\begin{pmatrix}x_2+\theta_2 y_2\\ x_1+\theta_1 y_1 + d\sqrt{1+\theta_1^2}\end{pmatrix}$$ and $$\begin{pmatrix}x\\ y\end{pmatrix} = \begin{pmatrix}1 & \theta_2\\ 1 & \theta_1\end{pmatrix}^{-1}\begin{pmatrix}x_2+\theta_2 y_2\\ x_1+\theta_1 y_1 - d\sqrt{1+\theta_1^2}\end{pmatrix}$$

-
Please explain how the part 2 of your answer corresponds with OP's question. OP seems to say, that he wants the distance between "new point" and $L_2$ to be the same as $d$. So, clearly the new point is not the relocated $P$. So, what is it? And, you have solved when the distance between relocated $P$ and the line $L_1$ is the same as the distance between P and $L_1$. – user21436 Dec 24 '11 at 17:36
And, I guess the equation for $L_1$ seems to have a misplace $\theta_1$. The equation should have been $y=\theta_1.x+y_1-\theta_1.x_1$ – user21436 Dec 24 '11 at 17:39