Co-ordinate of triangle: A(x1, y1), B(x2, y2), C(x3, y3) and Point P (x, y).

Approach:

  1. Calculate the area triangle that is are of triangle ABC. Area A
  2. Calculate the area of PAB. Area A1
  3. Calculate the area of PBC. Area A2
  4. Calculate the area PCA. Area A3
  5. If Point P lies outside the triangle than A1+A2+A3 >A.

Area of Triangle: [x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)]/2

In above approach, we will have precision problem because we are dividing the result by 2. So to handle this issue, by taking off 2 times of triangle are.