One of the easiest ways to check if the area formed by the vertices of triangle
(x1,y1),(x2,y2),(x3,y3) is positive or not.
Area can by calculated by the formula:
1/2 [x1(y2–y3) + x2(y3–y1) + x3(y1–y2)]
or python code can be written as:
def triangleornot(p1,p2,p3):
return (1/ 2) [p1[0](p2[1]–p3[1]) + p2[0] (p3[1]–p1[1]) + p3[0] (p1[0]–p2[0])]