def b_line(x0, y0, xf, yf):
    """ Implementation of Bresenham Algorithm - Adapted from Java
    Based on algorithm listed here: http://tech-algorithm.com/articles/drawing-line-using-bresenham-algorithm/
    Translated to Python by Maxwell Grady

    :param x0: int initial x location of line segment
    :param y0: int initial y location of line segment
    :param xf: int final x location of line segment
    :param yf: int final y location of line segment
    :returns:  list of points in (r,c) format for pixels along the line segment
    """
    w = xf - x0
    h = yf - y0
    dx1 = 0
    dy1 = 0
    dx2 = 0
    dy2 = 0
    if w < 0:
        dx1 = -1
        dx2 = -1
    elif w > 0:
        dx1 = 1
        dx2 = 1
    if h < 0:
        dy1 = -1
    elif h > 0:
        dy1 = 1
    longest = abs(w)
    shortest = abs(h)
    if not longest > shortest:
        longest = abs(h)
        shortest = abs(w)
        if h < 0:
            dy2 = -1
        elif h > 0:
            dy2 = 1
        dx2 = 0
    numerator = longest >> 1
    x = x0
    y = y0
    points = []
    for i in range(longest + 1):
        points.append((y, x))
        numerator += shortest
        if not numerator < longest:
            numerator -= longest
            x += dx1
            y += dy1
        else:
            x += dx2
            y += dy2
    return points
