Determine if a point is inside or outside of a triangle whose vertices are the points
(x_{1}, y_{1}), (x_{2}, y_{2}) and (x_{3}, y_{3}).

By vectors analysis  if the cross product of the vectors:
are all positive or all negative, the point is inside the triangle.
The cross product of all three pairs of the triangle sides are:
After solving the determinants we get the values:
k_{1} = (p_{x} ⎯ x_{1})•(y_{2} ⎯ y_{1}) ⎯ (p_{y} ⎯ y_{1})•(x_{2} ⎯ x_{1})
k_{2} = (p_{x} ⎯ x_{2})•(y_{3} ⎯ y_{2}) ⎯ (p_{y} ⎯ y_{2})•(x_{3} ⎯ x_{2})
k_{3} = (p_{x} ⎯ x_{3})•(y_{1} ⎯ y_{3}) ⎯ (p_{y} ⎯ y_{3})•(x_{1} ⎯ x_{3})
If all three equations are either positive or negative then the point (p_{x}, p_{y}) is inside the triangle.

If triangle is given by the lines equations:
y = m_{1}x + b_{1}
y = m_{2}x + b_{2}
y = m_{3}x + b_{3}

Find intersection points of the sides of the triangle.
After finding the intersection points use the vector method.

Example: given a triangle whose vertices are at (3, ⎯ 2), (1, 5) and (⎯ 3, 2) determine if
the point (1, 3) is inside or outside of the triangle.

Find k_{1}, k_{2} and k_{3}.
k_{1} = (1 ⎯ 3)•(5 ⧾ 2) ⎯ (3 ⧾ 2)•(1 ⎯ 3) = ⎯ 4
k_{2} = (1 ⎯ 1)•(2 ⎯ 5) ⎯ (3 ⎯ 5)•(⎯ 3 ⎯ 1) = ⎯ 8
k_{3} = (1 ⧾ 3)•(⎯ 2 ⎯ 2) ⎯ (3 ⎯ 2)•(3 ⧾ 3) = ⎯ 22
Because the signs of k_{1}, k_{2} and k_{3} are all negative the point is inside the given triangle.

The vector analysis can be applied to any convex polygon that has n sides to determine if the point p is inside the polygon.

k_{1} = (p_{x} ⎯ x_{1})•(y_{2} ⎯ y_{1}) ⎯ (p_{y} ⎯ y_{1})•(x_{2} ⎯ x_{1})
···
k_{n1} = (p_{x} ⎯ x_{n1})•(y_{n} ⎯ y_{n1}) ⎯ (p_{y} ⎯ y_{n1})•(x_{n} ⎯ x_{n1})
···
k_{n} = (p_{x} ⎯ x_{n})•(y_{1} ⎯ y_{n}) ⎯ (p_{y} ⎯ y_{n})•(x_{1} ⎯ x_{n})
This calculation should apply to each side of the polygon from 1 to n. If the signs of all k's are the same
positive or negative then the point p is inside the polygon.
Note: this method applies only to convex polygons.
