0

So I've got the following problem:

I have points A and B and I draw a line going from A to B. Knowing the coordinates of each point, I need to find out if the point C is on the right side of the line. Everything is placed in a 2 dimensional space.

How am I supposed to solve this problem?

Cathier
  • 43
  • 'on the right side of the line'. Do you mean the part of the cartesian plane where majority of the $+ve\ x$-axis lies ? – 8hantanu Dec 31 '16 at 09:36

3 Answers3

1

$\begin{vmatrix}x_A & x_B & x_C\\y_A & y_B & y_C\\1 & 1 & 1\end{vmatrix}$ is known to be twice the oriented area of triangle ABC (with "+" sign if positively oriented, otherwise "-" sign). See for example (Show that the area of a triangle is given by this determinant).

It suffices then to check, for a given point $(x,y)$, if $\begin{vmatrix}x_A & x_B & x_C\\y_A & y_B & y_C\\1 & 1 & 1\end{vmatrix}$ and $\begin{vmatrix}x_A&x_B&x\\y_A&y_B&y\\1 & 1 & 1\end{vmatrix}$ have the same sign or not.

Remark: this solution has a very close relationship, under a different aspect, with the solution given by @Robert Z.

Jean Marie
  • 81,803
0

Take the vector product $w$ of $(u_x,u_y,0):=C-A$ and $(v_x,v_y,0):=B-A$. Then $w_x=w_y=0$, and $w_z=u_x v_y-u_yv_x$.

If $w_z>0$ then $C$ is on the right of $B-A$. If $w_z<0$ then $C$ is on the left of $B-A$. Equality holds when $C$ is on the line $AB$.

Robert Z
  • 145,942
0

Find the equation of line using the given two co-ordinates $A$ and $B$ and write it in the form $y-mx+c=0$.

Substitute the co-ordinates of $C$ in $y-mx+c$. Let this value be $k$.

If $km<0$ then point is on right side of the line, if $km>0$ then on the left side.

Note: If $km=0$, then the point $C$ lies on the line or the slope of the line is $0$ or both. When $m=0$ you cannot define the left/right side.

8hantanu
  • 1,843