def getQuarter(side, point):
    """
    Given a 2d point, returns the corresponding quarter ID.

    The path of the robot is split in 4 segments, each segment corresponds
    to one edge of the square. Since the robot is not exactly on the edge, we
    need a way to map any point to one of the 4 edges. To do this we split the
    world into 4 quarters using the extended diagonals of the square. Each
    quarter corresponds to one edge of the square. The ID of each quarter
    corresponds to the order in which the robot will go through them.

    side: size of one side of the square, in meters.
    point: tuple containing x and y coordinates.

    returns 0, 1, 2 or 3 depending on the quarter in which the point is located
    """
    # Checks on which side of the bottom-left to top-right diagonal the point
    # is.
    posDiag = (point[1] - point[0] > 0)

    # Checks on which side of the top-left to bottom-right diagonal the point
    # is.
    negDiag = (point[0] + point[1] - side < 0)

    if posDiag:
        if negDiag:
            return 0
        else:
            return 3
    else:
        if negDiag:
            return 1
        else:
            return 2