for p in points:
    hashesToPoints.setdefault(hash(p), set()).add(p)
for p1 in points:
    for p2 in points:
        p3, p4 = mixCoordinates(p1, p2)
How do I check if cartesian coordinates make up a rectangle efficiently?