def overlap(x, y, tol=0):
    """Check if two line segments overlap

    Parameters
    ----------
    x : list
        A list with the start and end point of the first line segment
    y : lits
        A list with the start and end point of the second line segment
    tol : float
        The tolerance to consider lines overlapping. Default 0, positive
        value indicate small overlaps are not considered, negitive values
        idicate small gaps are not considered.

    Returns
    -------
    overlap : bool
        True if the two line segments overlap, False otherwise
    """
    return x[1] - tol >= y[0] + tol and y[1] - tol >= x[0] + tol
