Can someone please show me an algorithm for writing a function that returns true if 4 points form a quadrangle, and false otherwise? Glasses have no order.
I tried to check all the permutations of 4 points and see if there are 3 points that form a straight line. If there are 3 points that form a straight line, not a quadrangular. But then I understand that there is no way to tell the order. And then I fight for hours of thinking and searching on Google to no avail :(
I read the following questions:
But do not find a solution. In case 1, he cannot detect another kind of quadrangle, and in 2 he assumes that the points are already quadratheral. Is there any other way to know if 4 points form a quadrangular?
Thanks before.
EDIT FOR CLARIFICATION:
I define a quadrangle as a simple quadrangle, basically all the shapes shown in this picture: 
except for the shape labeled "quadrangle" and "complex."
As for the problems with the “collinear triplet check” approach, I tried to check the vertical, horizontal and diagonal lines like this:
def is_linear_line(pt1, pt2, pt3): return (pt1[x] == pt2[x] == pt3[x] || pt1[y] == pt2[y] == pt3[y] || slope(pt1, pt2) == slope(pt2, pt3))
And understand that the rectangle and square will be considered linear, since the slope of the points will be the same. Hope this clarifies the situation.
source share