def possible_rect(quartet):
    """
    validate that 4 points form a rectangle by comparing distance to centroid of the rectangle for all corners
    :param quartet: The four points of the rectangle
    :return: True if all 4 points have same distance to the centroid, False otherwise
    :rtype: bool
    """
    mid_x = 0
    mid_y = 0

    # centroid
    for c in quartet:
        mid_x += c.i / 4.0
        mid_y += c.j / 4.0

    # reference distance using first corner
    dx = abs(quartet[0].i - mid_x)
    dy = abs(quartet[0].j - mid_y)

    # Check all the same distance from centroid are equals
    for i in range(1, len(quartet)):
        if abs(quartet[i].i - mid_x) != dx or abs(quartet[i].j - mid_y) != dy:
            return False
    return True