Position of Point with respect to a Triangle

1.2k Views Asked by At

Consider a triangle formed by three sides, equations of which are as follows -

a1x + b1y + c1=0

a2x + b2y + c2=0

a3x + b3y + c3=0

Is there a nice method to figure out whether a point P(h,k) lies inside or outside the triangle formed by these lines?

It'd be great if some sort of a formula could be derived using the variables mentioned above. In fact, a brief outline of the approach followed while getting to the formula would be great too.

Thanks a lot.

2

There are 2 best solutions below

0
On

Here's a method (not a formula) . . .

  • Solve each pair of two equations in two unknowns to find the vertices, $U,V,W$ say.$\\[4pt]$
  • Check to make sure that $U,V,W$ are not collinear.$\\[4pt]$
  • Find the centroid $G={\large{\frac{U+V+W}{3}}}$.$\\[4pt]$
  • Let $p_1,p_2,p_3$ and $g_1,g_2,g_3$ be the results of plugging the coordinates of $P$ and $G$, respectively, into the left-hand-sides of each of the three equations.

Then

  • If at least one of the products $p_1g_1,p_2g_2,p_3g_3$ is negative, then $P$ is outside triangle $UVW$.$\\[4pt]$
  • If all three of the products $p_1g_1,p_2g_2,p_3g_3$ are nonnegative, and at least one of them is zero, then $P$ is on the boundary of triangle $UVW$.$\\[4pt]$
  • If all three of the products $p_1g_1,p_2g_2,p_3g_3$ are positive, then $P$ is inside triangle $UVW$.
0
On

Method:

1) Solve the equations pairwise to find the vertices $A,B,C$ of the triangle $ABC$.

2) Calculate the areas of $\Delta APB$, $\Delta BPC$, $\Delta APC$ and $\Delta ABC$.

3) If $S_{\Delta ABC}=S_{\Delta APB}+S_{\Delta BPC}+S_{\Delta APC}$, then $P$ is inside. If LHS is less than RHS, then $P$ is outside.